@hearsay-tools/squawk 0.19.0-dev.9269 → 0.19.0-dev.9292
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/hosts.d.ts +76 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +1354 -1288
- package/dist/contract/project-signal.d.ts +31 -0
- package/dist/delegation/routes.d.ts +4 -4
- package/dist/delegation/transport.d.ts +10 -10
- package/dist/features/automations/tools.d.ts +8 -8
- package/dist/features/hosts/index.js +2 -0
- package/dist/features/hosts/index.js.map +1 -1
- package/dist/features/hosts/routes.d.ts +45 -1
- package/dist/features/hosts/routes.js +109 -1
- package/dist/features/hosts/routes.js.map +1 -1
- package/dist/features/hosts/runs-index-patch.d.ts +5 -0
- package/dist/features/hosts/runs-index-patch.js +36 -0
- package/dist/features/hosts/runs-index-patch.js.map +1 -1
- package/dist/features/hosts/runs-index.d.ts +9 -1
- package/dist/features/hosts/runs-index.js +27 -0
- package/dist/features/hosts/runs-index.js.map +1 -1
- package/dist/runs/run-exits.d.ts +352 -352
- package/dist/runs/run-index.d.ts +2 -0
- package/dist/runs/run-index.js +9 -1
- package/dist/runs/run-index.js.map +1 -1
- package/dist/server/repo-routes.d.ts +13 -13
- package/dist/server/server.d.ts +1379 -1379
- package/dist/workflows/continuation-admission.d.ts +72 -72
- package/dist/workflows/input-acknowledgement.d.ts +24 -24
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-BHP8K_nY.js +1 -0
- package/web/dist/assets/activity-motion-DEEIuaki.js +1 -0
- package/web/dist/assets/{activity-route-CruXBXE5.js → activity-route-vtZmQsDB.js} +1 -1
- package/web/dist/assets/agent-accounts-BC78GKYv.js +1 -0
- package/web/dist/assets/{agent-config-section-BUxTgHrB.js → agent-config-section-CbnVaIx7.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BXUzcpEv.js → agent-defaults-section-Blxd9IpY.js} +1 -1
- package/web/dist/assets/{appearance-DnPsNI40.js → appearance-B_y9StVj.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DR-KA2nj.js → archive-on-merge-field-DlChylWt.js} +1 -1
- package/web/dist/assets/{ask-card-DqWVy7zb.js → ask-card-DzWKRJ1x.js} +3 -3
- package/web/dist/assets/attention-C33sN0aA.js +1 -0
- package/web/dist/assets/automations-route-DxE9u9p0.js +2 -0
- package/web/dist/assets/{commit-list-zMKEapLK.js → commit-list-SxBDO_q5.js} +1 -1
- package/web/dist/assets/diff-B6Ye5Xg9.js +3 -0
- package/web/dist/assets/{diff-controls-DbkfJxfp.js → diff-controls-BFQOIJ97.js} +1 -1
- package/web/dist/assets/{diff-view-Cl7rXVa_.js → diff-view-BkF3xtYW.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-BYLEBMpG.js → discard-changes-dialog-CaS0koto.js} +1 -1
- package/web/dist/assets/{file-preview-CBjQS3sX.js → file-preview-ByWn2eDz.js} +1 -1
- package/web/dist/assets/{folder-browser-_2PCbZWK.js → folder-browser-CHTNDBIU.js} +1 -1
- package/web/dist/assets/{git-toolbar-CAAZ5T8F.js → git-toolbar-COI-N232.js} +1 -1
- package/web/dist/assets/github-CAQJIg-J.js +1 -0
- package/web/dist/assets/{global-activity-route-BQz9m_XA.js → global-activity-route-99-UqSlC.js} +1 -1
- package/web/dist/assets/hosts-BDfuQnus.js +1 -0
- package/web/dist/assets/index-BAXboPqe.js +21 -0
- package/web/dist/assets/label-Qj4HjGeN.js +1 -0
- package/web/dist/assets/{markdown-CcQNTOHx.js → markdown-D7p7x8Pe.js} +1 -1
- package/web/dist/assets/{open-in-menu-WJ8dhdTo.js → open-in-menu-D07DgRwh.js} +1 -1
- package/web/dist/assets/{option-select-DGRezng8.js → option-select-BvsSDWBz.js} +1 -1
- package/web/dist/assets/{preferences-section-DfiqoVZx.js → preferences-section-DkdcKxmS.js} +1 -1
- package/web/dist/assets/{preview-DXX3jdRy.js → preview-7NPVVq1D.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Bf6SWOsM.js → preview-pane-connected-B3f0fR6q.js} +2 -2
- package/web/dist/assets/{project-location-8EYHMbCE.js → project-location-CvZY7aOx.js} +1 -1
- package/web/dist/assets/{project-router-TP6DSj1S.js → project-router-l_pJCK5X.js} +1 -1
- package/web/dist/assets/project-scope-context-_6sNMsAf.js +4 -0
- package/web/dist/assets/{projects-section-CaKm84OL.js → projects-section-DGzDfKN_.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-Bh6YEqh0.js → prompt-templates-section-DbHe-j9Z.js} +1 -1
- package/web/dist/assets/queries-CPNrCEon.js +1 -0
- package/web/dist/assets/read-state-BXLUf0Xi.js +1 -0
- package/web/dist/assets/reference-chip-B32qTHb5.js +1 -0
- package/web/dist/assets/{remote-settings-notice-cNffux8C.js → remote-settings-notice-ByPYNQyB.js} +1 -1
- package/web/dist/assets/{repo-git-nFi9DHBQ.js → repo-git-4rKalM-L.js} +1 -1
- package/web/dist/assets/{report-reader-BbA7ERJe.js → report-reader-IAYhP0KQ.js} +1 -1
- package/web/dist/assets/{report-selection-DOq2dcjz.js → report-selection-DCC-F7i6.js} +1 -1
- package/web/dist/assets/{reports-iMUK2IiW.js → reports-BP_hajNp.js} +1 -1
- package/web/dist/assets/{resources-section-BsPU-yD9.js → resources-section-QNbLbu3j.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-BncrXliY.js → review-notes-drafts-CB8u-M0E.js} +1 -1
- package/web/dist/assets/{review-panel-CTc1ypIJ.js → review-panel-Bw8yG2xg.js} +1 -1
- package/web/dist/assets/{review-strip-D1gmgNIH.js → review-strip-BojRnCkg.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-B4t_zvMa.js → run-detail-refresh-CZ7VyCgP.js} +1 -1
- package/web/dist/assets/{run-diff-CbyXSgBK.js → run-diff-CMZgQG9B.js} +1 -1
- package/web/dist/assets/run-header-D7LZBbaL.js +2 -0
- package/web/dist/assets/{select--NKdUD0C.js → select-D9BIA_Kn.js} +1 -1
- package/web/dist/assets/{session-context-section-D02yRmGY.js → session-context-section-CxFRidmv.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-GPhOc6Lz.js → settings-agent-picker-Cy_ZpuNd.js} +1 -1
- package/web/dist/assets/{settings-save-bar-CroXxZIi.js → settings-save-bar-DzbndGGQ.js} +1 -1
- package/web/dist/assets/settings-shell-DS8k_xP6.js +1 -0
- package/web/dist/assets/{sidebar-section-BOtjR98E.js → sidebar-section-CY978tNF.js} +1 -1
- package/web/dist/assets/{skills-C7MuiePR.js → skills-WZ5YRCbF.js} +1 -1
- package/web/dist/assets/{status-dot-Bn3O77El.js → status-dot-Dvy-rnDJ.js} +1 -1
- package/web/dist/assets/{tab-link-BeONvGY1.js → tab-link-BPkGPOYd.js} +1 -1
- package/web/dist/assets/task-changes-Dd2KHRQ6.js +5 -0
- package/web/dist/assets/task-commits-De0FVgKP.js +1 -0
- package/web/dist/assets/{task-file-scope-BfJ7TDbf.js → task-file-scope-C_cr_ix-.js} +1 -1
- package/web/dist/assets/{task-files-CNz4PSKs.js → task-files-resMdu9u.js} +1 -1
- package/web/dist/assets/{task-github-item-B0mRxbLm.js → task-github-item-Hz1RbO88.js} +1 -1
- package/web/dist/assets/task-groups-Bc_WNTMe.js +1 -0
- package/web/dist/assets/task-thread-D7vUf0g7.js +2 -0
- package/web/dist/assets/{thread-state-B_uTIWzc.js → thread-state-Bjh3rImx.js} +1 -1
- package/web/dist/assets/{unified-diff-JD9Q6oCe.js → unified-diff-weWjKedZ.js} +1 -1
- package/web/dist/assets/use-finish-run-BuyJkeEN.js +1 -0
- package/web/dist/assets/{use-hand-to-agent-state-zwUimLza.js → use-hand-to-agent-state-CSDPzpM7.js} +1 -1
- package/web/dist/assets/use-path-bases-DgEkRWYi.js +1 -0
- package/web/dist/assets/use-workspace-config-save-M2ethek2.js +1 -0
- package/web/dist/assets/{workflows-BXDmsEl-.js → workflows-DtnnAq4w.js} +1 -1
- package/web/dist/assets/{workspace-tools-Ehk2KrtT.js → workspace-tools-CSLTEwLa.js} +1 -1
- package/web/dist/assets/{worktrees-section-DWZwtc3-.js → worktrees-section-Crp31i8F.js} +1 -1
- package/web/dist/index.html +17 -14
- package/web/dist/assets/accounts-section-uuhrLHok.js +0 -1
- package/web/dist/assets/activity-motion-CHyZRjxl.js +0 -1
- package/web/dist/assets/agent-accounts-CSU96w_T.js +0 -1
- package/web/dist/assets/automations-route-BmCWqncy.js +0 -2
- package/web/dist/assets/diff-BPw0S-BU.js +0 -3
- package/web/dist/assets/github-DehUrgzW.js +0 -1
- package/web/dist/assets/hosts-BEeMKHcf.js +0 -1
- package/web/dist/assets/index-D0RESQCN.js +0 -21
- package/web/dist/assets/label-VKt-7Z5C.js +0 -1
- package/web/dist/assets/project-scope-context-BWHk0niI.js +0 -4
- package/web/dist/assets/queries-Byfl3YoC.js +0 -1
- package/web/dist/assets/reference-chip-rDOAte2y.js +0 -1
- package/web/dist/assets/run-header-BREol2Ej.js +0 -2
- package/web/dist/assets/settings-shell-CEDsPkJW.js +0 -1
- package/web/dist/assets/task-changes-CPDdG-BK.js +0 -5
- package/web/dist/assets/task-commits-BFWXi7xF.js +0 -1
- package/web/dist/assets/task-thread-DH9xiw7O.js +0 -2
- package/web/dist/assets/use-finish-run-D7Ll1bwP.js +0 -1
- package/web/dist/assets/use-path-bases-BmFE7O79.js +0 -1
- package/web/dist/assets/use-workspace-config-save-71tIi9IP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,Dt as i,at as a,rn as o}from"./queries-Byfl3YoC.js";import{g as s}from"./host-context-KsSKxKbI.js";import{Hi as c,Ii as l,Mn as u,On as d,Qi as f,Tn as p,ea as m,ir as h,nr as g}from"./project-scope-context-BWHk0niI.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-CNUmr-VT.js";import{h as T,p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as D}from"./dist-CCX8mhHc.js";import{Q as ee}from"./design-icons-QbNMZniQ.js";import{t as te}from"./arrow-up-right-DKGzsMqY.js";import{t as O}from"./chevron-right-BENZ-1ZN.js";import{t as k}from"./eye-B8okNWXU.js";import{t as A}from"./button-BV_AiLj2.js";import{t as j}from"./project-router-TP6DSj1S.js";import{f as M,i as N,n as P,r as ne,t as re,u as F}from"./page-shell-BdjH5hyc.js";import{t as I}from"./use-search-params-writer-DD5PEEZw.js";import{Tn as L,j as R,lr as z,qn as B,vr as V,zn as H}from"./index-D0RESQCN.js";import{t as U}from"./report-title-D4Mbu2Er.js";import{t as W}from"./html-report-frame-Bk6UkqKa.js";var G=e(t(),1),K=1e3,q=S().min(1).max(1024);_({q:S().max(K).optional(),before:q.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var J=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:l}).strict()),nextCursor:q.nullable(),total:w().int().nonnegative()}).strict(),Y=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),ie=_({runId:b(),taskTitle:S(),taskStatus:l}).strict(),ae=v(`type`,[Y.extend({type:y(`snapshot`)}),Y.extend({type:y(`content`)}),Y.extend({type:y(`metadata`),runs:x(ie)})]),X=new WeakMap;function oe(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var se=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=oe(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function ce(e,t){let n=X.get(e);n||(n=new Map,X.set(e,n));let r=n.get(t);return r||(r=new se(e,t),n.set(t,r)),r}async function le(e,t){let n=await p.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},d({signal:t}));return Y.parse(await u(n,`/reports/state`))}function ue(e){let t=ce(m(),e);return(0,G.useEffect)(()=>{let n=a(`reports:project:${e}`,e=>{let n=ae.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,s=()=>{if(g()===`finite`&&!r){i=new AbortController;let n=i.signal;le(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=o({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=Y.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else g()!==`finite`&&(i?.abort(),r?.(),r=void 0)};s();let c=h(s);return()=>{c(),i?.abort(),r?.(),n()}},[t,e]),t}async function de(e,t,n,r){let i=await p.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,K),...n?{before:n}:{}}},d(r?{signal:r}:void 0));return J.parse(await u(i,`/reports`))}function fe(e){let t=s(),n=ue(t);return c({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>de(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map,$={title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`};function pe(){let e=B(),t=r();return e===`unknown`?(0,Z.jsx)(F,{route:`reports`,density:`full`,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsx)(`div`,{"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:t.isError&&!t.isFetching?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.error instanceof Error?t.error.message:`Could not reach the server`}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})})}):e===`absent`?(0,Z.jsx)(R,{}):(0,Z.jsx)(me,{})}function me(){let e=E(),t=T(),[n,r]=I(),i=(n.get(`q`)??``).slice(0,K),a=fe(i),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(``),l=e.pathname+e.search,u=a.data?.pages.flatMap(e=>e.reports)??[],d=e=>{Q.set(l,{scroll:s.current?.scrollTop??0,row:e,pages:a.data?.pages.length??1})},[f,p]=(0,G.useState)(null),m=N(o);(0,G.useLayoutEffect)(()=>{if(!a.data||c.current===l)return;let n=Q.get(l),r=e.state?.filesRestoreKey===l;if(!n||!s.current||t!==`POP`&&!r){c.current=l;return}let i=s.current.querySelector(`[data-report-id="${n.row}"]`);if(a.isFetchNextPageError){c.current=l,s.current.scrollTop=0;return}if((!i||a.data.pages.length<n.pages)&&a.hasNextPage){a.isFetchingNextPage||a.fetchNextPage();return}c.current=l,s.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[l,a.data,a.hasNextPage,a.isFetchingNextPage,a.isFetchNextPageError,a.fetchNextPage,e.state,t]);let h=t=>r(n=>(t?n.set(`q`,t.slice(0,K)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),g=u.find(e=>e.id===f)??u[0]??null,_=a.isPending?`full`:M(u.length);return(0,Z.jsx)(F,{route:`reports`,density:_,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsxs)(`div`,{ref:o,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(z,{maxLength:K,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:i,onChange:e=>h(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),a.isPending?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):a.isError&&u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.error.message}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]})}):u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(re,{icon:(0,Z.jsx)(V,{}),title:i?`No matching reports`:`No published reports yet`,description:i?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[L(),` artifact publish`]}),` `,`to list it here.`]}),actions:i?(0,Z.jsx)(A,{"data-slot":`reports-clear-search`,variant:`outline`,onClick:()=>h(``),children:`Clear search`}):(0,Z.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(j,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(ne,{list:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:u.map(e=>{let t=g?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":m&&t?`true`:void 0,className:D(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,m&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:U(e),children:(0,Z.jsx)(j,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:l,filesRestoreKey:l},onClick:()=>d(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:U(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(j,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(H,{className:`shrink-0`,iso:e.createdAt,prefix:`Published · `})]})]}),m?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${U(e)}`,"aria-pressed":t,onClick:()=>p(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(O,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),a.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(A,{variant:`outline`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:`Load more reports`})}):null,_===`sparse`?(0,Z.jsx)(P,{summary:`${u.length} published ${u.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:m&&g?(0,Z.jsx)(he,{report:g,restoreKey:l,onOpenReader:()=>d(g.id)}):null})]})})}function he({report:e,restoreKey:t,onOpenReader:n}){let r=(0,G.useContext)(f)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${U(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:U(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,(0,Z.jsx)(H,{iso:e.createdAt,prefix:`Published · `})]})]}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`shrink-0 py-1.5`,children:(0,Z.jsxs)(j,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(te,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(ge,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function ge({report:e}){let t=i(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(W,{html:n.content,title:U(e),className:`min-h-0 flex-1`})}export{pe as ReportsRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,Dt as i,at as a,rn as o}from"./queries-CPNrCEon.js";import{g as s}from"./host-context-KsSKxKbI.js";import{Mn as c,On as l,Tn as u,Zi as d,ha as f,ir as p,nr as m,pa as h,ra as g}from"./project-scope-context-_6sNMsAf.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-CNUmr-VT.js";import{h as T,p as E}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as D}from"./dist-CCX8mhHc.js";import{Q as ee}from"./design-icons-QbNMZniQ.js";import{t as te}from"./arrow-up-right-DKGzsMqY.js";import{t as O}from"./chevron-right-BENZ-1ZN.js";import{t as k}from"./eye-B8okNWXU.js";import{t as A}from"./button-BV_AiLj2.js";import{t as j}from"./project-router-l_pJCK5X.js";import{f as M,i as N,n as P,r as ne,t as re,u as F}from"./page-shell-BdjH5hyc.js";import{t as I}from"./use-search-params-writer-DD5PEEZw.js";import{Tn as L,j as R,lr as z,qn as B,vr as V,zn as H}from"./index-BAXboPqe.js";import{t as U}from"./report-title-D4Mbu2Er.js";import{t as W}from"./html-report-frame-Bk6UkqKa.js";var G=e(t(),1),K=1e3,q=S().min(1).max(1024);_({q:S().max(K).optional(),before:q.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var J=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:d}).strict()),nextCursor:q.nullable(),total:w().int().nonnegative()}).strict(),Y=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),ie=_({runId:b(),taskTitle:S(),taskStatus:d}).strict(),ae=v(`type`,[Y.extend({type:y(`snapshot`)}),Y.extend({type:y(`content`)}),Y.extend({type:y(`metadata`),runs:x(ie)})]),X=new WeakMap;function oe(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var se=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=oe(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function ce(e,t){let n=X.get(e);n||(n=new Map,X.set(e,n));let r=n.get(t);return r||(r=new se(e,t),n.set(t,r)),r}async function le(e,t){let n=await u.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},l({signal:t}));return Y.parse(await c(n,`/reports/state`))}function ue(e){let t=ce(f(),e);return(0,G.useEffect)(()=>{let n=a(`reports:project:${e}`,e=>{let n=ae.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,s=()=>{if(m()===`finite`&&!r){i=new AbortController;let n=i.signal;le(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=o({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=Y.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else m()!==`finite`&&(i?.abort(),r?.(),r=void 0)};s();let c=p(s);return()=>{c(),i?.abort(),r?.(),n()}},[t,e]),t}async function de(e,t,n,r){let i=await u.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,K),...n?{before:n}:{}}},l(r?{signal:r}:void 0));return J.parse(await c(i,`/reports`))}function fe(e){let t=s(),n=ue(t);return g({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>de(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map,$={title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`};function pe(){let e=B(),t=r();return e===`unknown`?(0,Z.jsx)(F,{route:`reports`,density:`full`,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsx)(`div`,{"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:t.isError&&!t.isFetching?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.error instanceof Error?t.error.message:`Could not reach the server`}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})})}):e===`absent`?(0,Z.jsx)(R,{}):(0,Z.jsx)(me,{})}function me(){let e=E(),t=T(),[n,r]=I(),i=(n.get(`q`)??``).slice(0,K),a=fe(i),o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(``),l=e.pathname+e.search,u=a.data?.pages.flatMap(e=>e.reports)??[],d=e=>{Q.set(l,{scroll:s.current?.scrollTop??0,row:e,pages:a.data?.pages.length??1})},[f,p]=(0,G.useState)(null),m=N(o);(0,G.useLayoutEffect)(()=>{if(!a.data||c.current===l)return;let n=Q.get(l),r=e.state?.filesRestoreKey===l;if(!n||!s.current||t!==`POP`&&!r){c.current=l;return}let i=s.current.querySelector(`[data-report-id="${n.row}"]`);if(a.isFetchNextPageError){c.current=l,s.current.scrollTop=0;return}if((!i||a.data.pages.length<n.pages)&&a.hasNextPage){a.isFetchingNextPage||a.fetchNextPage();return}c.current=l,s.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[l,a.data,a.hasNextPage,a.isFetchingNextPage,a.isFetchNextPageError,a.fetchNextPage,e.state,t]);let h=t=>r(n=>(t?n.set(`q`,t.slice(0,K)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),g=u.find(e=>e.id===f)??u[0]??null,_=a.isPending?`full`:M(u.length);return(0,Z.jsx)(F,{route:`reports`,density:_,fillHeight:!0,bodyClassName:`gap-4`,header:$,children:(0,Z.jsxs)(`div`,{ref:o,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(z,{maxLength:K,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:i,onChange:e=>h(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),a.isPending?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):a.isError&&u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.error.message}),(0,Z.jsx)(A,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]})}):u.length===0?(0,Z.jsx)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(re,{icon:(0,Z.jsx)(V,{}),title:i?`No matching reports`:`No published reports yet`,description:i?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[L(),` artifact publish`]}),` `,`to list it here.`]}),actions:i?(0,Z.jsx)(A,{"data-slot":`reports-clear-search`,variant:`outline`,onClick:()=>h(``),children:`Clear search`}):(0,Z.jsx)(A,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(j,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(ne,{list:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:u.map(e=>{let t=g?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":m&&t?`true`:void 0,className:D(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,m&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:U(e),children:(0,Z.jsx)(j,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:l,filesRestoreKey:l},onClick:()=>d(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:U(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(j,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(H,{className:`shrink-0`,iso:e.createdAt,prefix:`Published · `})]})]}),m?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${U(e)}`,"aria-pressed":t,onClick:()=>p(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(O,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),a.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(A,{variant:`outline`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:`Load more reports`})}):null,_===`sparse`?(0,Z.jsx)(P,{summary:`${u.length} published ${u.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:m&&g?(0,Z.jsx)(he,{report:g,restoreKey:l,onOpenReader:()=>d(g.id)}):null})]})})}function he({report:e,restoreKey:t,onOpenReader:n}){let r=(0,G.useContext)(h)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${U(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:U(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,(0,Z.jsx)(H,{iso:e.createdAt,prefix:`Published · `})]})]}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`shrink-0 py-1.5`,children:(0,Z.jsxs)(j,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(te,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(ge,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function ge({report:e}){let t=i(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(W,{html:n.content,title:U(e),className:`min-h-0 flex-1`})}export{pe as ReportsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{rt as t}from"./queries-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{rt as t}from"./queries-CPNrCEon.js";import{n}from"./chunk-KS7C4IRE-BdLLx37K.js";import{A as r}from"./design-icons-QbNMZniQ.js";import{t as i}from"./switch-B9OfOEzC.js";import{t as a}from"./centered-state-N8vWM_Hw.js";import{t as o}from"./option-select-BvsSDWBz.js";import{n as s}from"./save-cue-CpHgT93o.js";import{n as c,t as l}from"./settings-field-AyinSFR_.js";import{t as u}from"./use-workspace-config-save-M2ethek2.js";import{r as d}from"./settings-save-bar-DzbndGGQ.js";import{n as f}from"./saved-draft-BwzBc-_Y.js";var p=e(),m=1,h=16,g=16,_=1,v=60,y=5,b=256;function x(){let e=t();return e.isPending?(0,p.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,p.jsx)(a,{icon:(0,p.jsx)(r,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,p.jsx)(S,{config:e.data})}function S({config:e}){let t=u(),n=s(),r=s(),a=s(),o=s(),l=s(),m=(e,n)=>t.mutate(e,{onSuccess:n}),h=e.resources.monitoringWakeIntervalMinutes??null,g=h===null?`park`:`interval`,[x,S]=f(String(h??y)),D=Number(x),O=!Number.isInteger(D)||D<_||D>v,k=g===`interval`&&O,j=e=>m({resources:{monitoringWakeIntervalMinutes:e===`park`?null:y}},()=>{S(String(y)),a.flash()});d({dirty:h!==null&&x!==String(h),invalid:O,busy:t.isPending,save:()=>t.mutateAsync({resources:{monitoringWakeIntervalMinutes:D}}),discard:()=>S(String(h??y))});let M=e.resources.autoResumeOnUsageLimit??!0,N=e=>m({resources:{autoResumeOnUsageLimit:e}},o.flash),P=e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``,[F,I]=f(P),L=F.trim()===``?0:Number(F),R=F.trim()!==``&&(!Number.isInteger(L)||L<b);d({dirty:(e.resources.memoryLimitMb??0)!==(R?-1:L),invalid:R,busy:t.isPending,save:()=>t.mutateAsync({resources:{memoryLimitMb:L===0?null:L}}),discard:()=>I(P)});let z=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,p.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,p.jsx)(C,{maxParallel:e.resources.maxParallel,onSelect:e=>m({resources:{maxParallel:e}},n.flash),disabled:t.isPending,saved:n.saved}),(0,p.jsx)(w,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>m({resources:{maxMonitoringSessions:e}},r.flash),disabled:t.isPending,saved:r.saved}),(0,p.jsx)(T,{wakeMode:g,setWakeMode:j,wakeInterval:x,setWakeInterval:S,showInvalid:k,saved:a.saved,saveIsPending:t.isPending}),(0,p.jsx)(c,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,saved:o.saved,children:(0,p.jsx)(i,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:t.isPending,onCheckedChange:N})}),(0,p.jsx)(E,{memory:F,setMemory:I,memoryInvalid:R,saveIsPending:t.isPending}),(0,p.jsx)(A,{composerDefaults:z,saveComposerDefault:(e,t)=>m({composerDefaults:{[e]:t===`inherit`?null:t===`on`}},l.flash),saveIsPending:t.isPending,saved:l.saved})]})}function C({maxParallel:e,onSelect:t,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:r,onValueChange:e=>t(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(m,h)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,p.jsx)(n,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function w({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r,saved:i}){return(0,p.jsxs)(c,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,saved:i,children:[(0,p.jsx)(o,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onValueChange:e=>n(Number(e)),className:`settings-select w-28 max-w-full bg-card`,options:O(0,g)}),(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function T({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:a,saved:o,saveIsPending:s}){return(0,p.jsxs)(c,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,saved:o,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(i,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${l}`,children:`Wake interval`}),(0,p.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:_,max:v,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null]}),a?(0,p.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function E({memory:e,setMemory:t,memoryInvalid:n,saveIsPending:r}){return(0,p.jsxs)(c,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,p.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:b,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:r,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`})]}),n?(0,p.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,b,` MiB, or leave empty for no limit.`]}):null]})}var D=[{value:`inherit`,label:`Inherit environment`},{value:`on`,label:`On`},{value:`off`,label:`Off`}];function O(e,t){return Array.from({length:t-e+1},(t,n)=>({value:String(e+n),label:String(e+n)}))}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n,saved:r}){return(0,p.jsxs)(c,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,saved:r,children:[(0,p.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Autonomous by default`}),(0,p.jsx)(o,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onValueChange:e=>t(`autonomous`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,p.jsx)(`span`,{className:l,children:`Use a worktree by default`}),(0,p.jsx)(o,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onValueChange:e=>t(`worktree`,e),className:`settings-select max-w-full bg-card`,options:D}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{x as ResourcesSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Cn as n}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Cn as n}from"./index-BAXboPqe.js";var r=e(t(),1),i={open:!1,notes:``},a=new Map,o=new Set,s=null;function c(){let e=[...a.values()].some(e=>e.notes.trim()!==``);e&&s===null&&(s=n()),!e&&s!==null&&(s(),s=null);for(let e of o)e()}function l(e){return o.add(e),()=>{o.delete(e)}}function u(e){return a.get(e)??i}function d(e,t){let n={...u(e),...t};!n.open&&n.notes===``?a.delete(e):a.set(e,n),c()}function f(e){a.delete(e)&&c()}function p(e){let t=(0,r.useSyncExternalStore)(l,()=>u(e)),n=(0,r.useCallback)(t=>d(e,t),[e]),i=(0,r.useCallback)(()=>f(e),[e]);return{...t,update:n,clear:i}}export{d as n,p as r,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Tt as i}from"./queries-
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Tt as i}from"./queries-CPNrCEon.js";import{t as a}from"./review-strip-BojRnCkg.js";import{t as o}from"./eye-B8okNWXU.js";import{n as s}from"./centered-state-N8vWM_Hw.js";import{t as c}from"./run-diff-CMZgQG9B.js";var l=e({AcceptCelebration:()=>g,ReviewGateBanner:()=>f,ReviewPanel:()=>p,prefersReducedMotion:()=>m}),u=t(n(),1),d=r();function f({run:e,projectId:t,onResolved:n}){return(0,d.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,d.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,d.jsx)(o,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,d.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,d.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,d.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,d.jsx)(a,{run:e,projectId:t,onResolved:n})]})}function p({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,d.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,d.jsx)(f,{run:e,projectId:t,onResolved:n}),r?(0,d.jsx)(c,{runId:e.id,projectId:t,resultVersion:i(e)}):null]})}function m(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var h=1500;function g({status:e}){let t=(0,u.useRef)(e),[n,r]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||m())return;r(!0);let i=setTimeout(()=>r(!1),h);return()=>clearTimeout(i)},[e]),n?(0,d.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,d.jsx)(s,{}),(0,d.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,d.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{l as n,p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Rn as i,in as a,on as o,zn as s}from"./queries-CPNrCEon.js";import{a as c,ct as l,ha as u,ut as d,wn as f}from"./project-scope-context-_6sNMsAf.js";import{n as p}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as m,s as h}from"./dist-CCX8mhHc.js";import{I as g,l as _,y as v}from"./design-icons-QbNMZniQ.js";import{t as y}from"./createLucideIcon-BHp8sXmF.js";import{t as b}from"./external-link-BE6y205O.js";import{t as x}from"./eye-B8okNWXU.js";import{t as S}from"./button-BV_AiLj2.js";import{t as C}from"./project-router-l_pJCK5X.js";import{Ln as w,fn as T,rt as E,y as D}from"./index-BAXboPqe.js";import{t as O}from"./textarea-BGp28xFr.js";import{n as k,t as A}from"./use-finish-run-BuyJkeEN.js";import{r as j,t as M}from"./review-notes-drafts-CB8u-M0E.js";var N=y(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),P=e({ReviewActions:()=>R,ReviewStrip:()=>L}),F=t(n(),1),I=r();function L({run:e,projectId:t}){let n=D(e);return(0,I.jsx)(`section`,{"data-slot":`review-strip`,"aria-label":`Review the changes`,className:`sticky bottom-0 z-20 shrink-0 border-t border-info/35 bg-background`,children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 bg-info/10 px-4 py-2 md:flex-row md:items-start md:gap-4 md:px-9`,children:[(0,I.jsxs)(`p`,{"data-slot":`review-evidence`,className:`flex min-h-11 min-w-0 shrink-0 items-center gap-2 text-xs text-muted-foreground max-md:hidden`,children:[(0,I.jsx)(x,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Needs review`}),n.diff?(0,I.jsxs)(`span`,{"data-slot":`review-evidence-diff`,className:`flex items-center gap-1.5`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),n.diff.files,` `,n.diff.files===1?`file`:`files`,(0,I.jsx)(w,{stat:n.diff})]}):null,n.checks?(0,I.jsxs)(`span`,{"data-slot":`review-evidence-checks`,className:m(`flex items-center gap-1.5`,n.checks.failed&&`font-medium text-semantic-red`),children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),n.checks.label]}):null]}),(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(R,{run:e,projectId:t,reviewLink:!1})})]})})}function R({run:e,projectId:t,onResolved:n,reviewLink:r=!0}){let m=a(),v=u(),y=(0,F.useRef)(null),w=j(e.id),{notes:D,open:P,clear:L}=w,R=e=>w.update({notes:e}),[B,V]=(0,F.useState)(null),[H,U]=(0,F.useState)(null),W=A(e.id,{projectId:t,onSuccess:()=>{L(),n?.()}}),G=k(e,null,t),K=()=>v.invalidateQueries({queryKey:o.runs.all}),q=s({mutationFn:async n=>G.canContinue?l(i(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:G.runnerOverride}):null,onMutate:()=>i(e.id,{projectId:t}),onSuccess:(t,r,i)=>{t!==null&&(M(e.id).notes.trim()===r&&L(),m.invalidateAfter(`continue`,i),n?.())},onError:e=>c(e.message,{tone:`danger`})}),J=s({mutationFn:()=>d(e.id,t),onSuccess:e=>{c(`Draft PR created — ${e.url}`),L(),K(),n?.()},onError:e=>{e instanceof f&&e.manual!==void 0&&U(e.manual),c(e.message,{tone:`danger`})}}),Y=()=>{if(!P){w.update({open:!0}),requestAnimationFrame(()=>y.current?.focus());return}let e=D.trim();if(e.length===0){V(`Write what to change first.`),y.current?.focus();return}V(null),q.mutate(e)};return(0,I.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[G.canContinue?null:(0,I.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,I.jsx)(`span`,{children:G.reason}),G.providerPending?null:(0,I.jsx)(C,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button:not([data-button-size])]:min-h-11 [&_a:not([data-button-size])]:min-h-11`,children:[r?(0,I.jsx)(S,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,I.jsxs)(p,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,I.jsx)(x,{"aria-hidden":`true`}),`Review changes`]}):(0,I.jsxs)(C,{to:`/tasks/${e.id}/changes`,children:[(0,I.jsx)(x,{"aria-hidden":`true`}),`Review changes`]})}):null,(0,I.jsxs)(S,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:G.reason??(P?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":G.canContinue?void 0:`review-provider-guidance`,"aria-expanded":P,"aria-controls":P?`review-notes`:void 0,disabled:q.isPending||!G.canContinue,onClick:Y,children:[(0,I.jsx)(N,{"aria-hidden":`true`}),P?`Send back with notes`:`Send back`]}),h(e.pullRequestUrl)?(0,I.jsx)(S,{asChild:!0,variant:`outline`,size:`sm`,children:(0,I.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,I.jsx)(b,{"aria-hidden":`true`}),`PR ↗`]})}):(0,I.jsxs)(S,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:J.isPending,onClick:()=>J.mutate(),children:[(0,I.jsx)(g,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,I.jsxs)(S,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:T(`review`),disabled:W.isPending,onClick:()=>W.mutate(),children:[(0,I.jsx)(_,{"aria-hidden":`true`}),`Accept`]}):null]}),P?(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(O,{ref:y,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":B!==null||void 0,"aria-describedby":B===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:D,onChange:e=>{let t=e.target.value;R(t),B!==null&&t.trim().length>0&&V(null)},onKeyDown:e=>{E(e)&&(e.preventDefault(),Y())},className:`max-h-[min(24dvh,180px)] min-h-11 overflow-y-auto overscroll-contain text-base md:text-[13px]`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[B===null?(0,I.jsx)(`span`,{}):(0,I.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:B}),(0,I.jsx)(S,{"data-slot":`review-notes-cancel`,variant:`ghost`,size:`sm`,title:`Fold the notes box and drop the notes`,onClick:()=>{V(null),L()},children:`Cancel`})]})]}):null,H===null?null:(0,I.jsx)(z,{command:H})]})}function z({command:e}){return(0,I.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>c(`Command copied to clipboard.`)).catch(()=>c(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,I.jsx)(v,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}export{P as n,R as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{on as e}from"./queries-
|
|
1
|
+
import{on as e}from"./queries-CPNrCEon.js";function t(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function n(n){let r=new Map,i=e=>n.getQueryCache().find({queryKey:e,exact:!0}),a=e=>{if(!e.owed||e.timer!==void 0)return;let t=i(e.key);if(!t){e.owed=!1;return}if(!t.isActive()){e.owed=!1,n.invalidateQueries({queryKey:e.key,exact:!0,refetchType:`none`});return}if(t.state.fetchStatus!==`idle`)return;let r=e.lastStart+400-Date.now();if(r>0){e.timer=setTimeout(()=>{e.timer=void 0,a(e)},r);return}e.owed=!1,e.lastStart=Date.now(),n.refetchQueries({queryKey:e.key,exact:!0,type:`active`},{cancelRefetch:!1})},o=n.getQueryCache().subscribe(e=>{if(e.type!==`updated`||r.size===0)return;let i=r.get(JSON.stringify(e.query.queryKey));if(i){if(e.action.type===`success`&&!e.action.manual){let r=e.query.promise;r&&i.preEvent.has(r)&&(i.preEvent.delete(r),t(n,i.key),i.owed=!0)}e.query.state.fetchStatus===`idle`&&a(i)}}),s=(t,n)=>n?[n,`runs`,`detail`,t]:e.runs.detail(t);return{onEvent(e,o){let c=s(e,o),l=i(c);if(!l)return;let u=JSON.stringify(c),d=r.get(u);d||(d={key:c,owed:!1,lastStart:0,preEvent:new WeakSet},r.set(u,d)),l.state.fetchStatus!==`idle`&&l.promise&&d.preEvent.add(l.promise),t(n,c),d.owed=!0,a(d)},forget(e,t){let n=JSON.stringify(s(e,t));clearTimeout(r.get(n)?.timer),r.delete(n)},cancel(){o();for(let e of r.values())clearTimeout(e.timer);r.clear()}}}function r(t){let n=new Map;return{refresh(r,i){let a=i?[i,`runs`,`detail`,r]:e.runs.detail(r);if(!t.getQueryState(a))return;let o=JSON.stringify(a);clearTimeout(n.get(o)),t.cancelQueries({queryKey:a}),n.set(o,setTimeout(()=>{n.delete(o),t.invalidateQueries({queryKey:a})},400))},cancel(){for(let e of n.values())clearTimeout(e);n.clear()}}}export{r as n,t as r,n as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Zt as r,on as i,qt as a}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Zt as r,on as i,qt as a}from"./queries-CPNrCEon.js";import{ha as o,pi as s}from"./project-scope-context-_6sNMsAf.js";import{o as c}from"./dist-CCX8mhHc.js";import{t as l}from"./chevron-right-BENZ-1ZN.js";import{t as u}from"./button-BV_AiLj2.js";import{n as d,r as f,t as p}from"./collapsible-D5i3hm2L.js";import{i as m,r as h}from"./highlighter-Crq-WTmN.js";import{a as g,n as _,o as v,r as y}from"./unified-diff-weWjKedZ.js";var b=e(t(),1),x=n(),S=20,C=300;function w(e){return!!(e&&e.trim().startsWith(`(no worktree`))}function T(e){return!e||e.diff.state!==`available`||e.diff.patch===void 0?null:{patch:e.diff.patch,banner:{observedAt:e.observedAt,headSha:e.head.sha,truncated:e.diff.truncated||!!e.diff.patchTruncated,worktreeRemoved:v(e)}}}function E(e,t,n){let i=a(e,t),o=(0,b.useMemo)(()=>y(i.data??``),[i.data]),s=i.isError||i.isSuccess&&o.length===0&&w(i.data),c=r(e,{includeDiff:!0,projectId:t,enabled:s,version:n}),l=s?T(c.data):null,u=(0,b.useMemo)(()=>l?y(l.patch):[],[l]);return{pending:i.isPending||s&&c.isPending,error:!l&&i.isError?i.error:null,files:l?u:o,storedBanner:l?l.banner:null,emptyText:l?`No changes recorded in stored snapshot`:i.data?.trim()||`(no changes)`}}function D({runId:e,projectId:t,resultVersion:n}){let r=o();(0,b.useEffect)(()=>{let a=t?[t,`runs`,`diff`,e]:i.runs.diff(e);r.invalidateQueries({queryKey:a}),r.invalidateQueries({queryKey:i.runs.result(e,!0,s,t,n)})},[t,r,n,e]);let a=E(e,t,n),[c,l]=(0,b.useState)(!1);if(a.pending)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(a.error)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:a.error.message});let d=a.storedBanner?(0,x.jsx)(g,{...a.storedBanner,variant:`card`}):null;if(a.files.length===0)return d?(0,x.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[d,(0,x.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:a.emptyText})]}):(0,x.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:a.emptyText});let f=_(a.files),p=c?a.files:a.files.slice(0,S);return(0,x.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[d,(0,x.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,x.jsxs)(`span`,{children:[f.files,` `,f.files===1?`file`:`files`,` changed`]}),(0,x.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,f.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,f.deletions]})]})]}),p.map(e=>(0,x.jsx)(k,{file:e},`${e.oldPath??``}→${e.path}`)),a.files.length>p.length?(0,x.jsxs)(u,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>l(!0),children:[`Show `,a.files.length-p.length,` more files`]}):null]})}var O={added:`added`,deleted:`deleted`,renamed:`renamed`};function k({file:e}){let[t,n]=(0,b.useState)(!0),r=O[e.status],i=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,x.jsxs)(p,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-card-edge bg-card shadow-card`,children:[(0,x.jsxs)(f,{className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,x.jsx)(l,{className:c(`mbs-[1px] size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,x.jsx)(`span`,{"data-slot":`diff-file-path`,title:i,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:e.oldPath?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,x.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-xs font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,e.deletions]})]})]}),(0,x.jsx)(d,{children:(0,x.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,x.jsx)(A,{lines:e.lines})})})]})}function A({lines:e}){let[t,n]=(0,b.useState)(!1),r=t?e:e.slice(0,C),i=r.join(`
|
|
2
2
|
`),[a,o]=(0,b.useState)(null);(0,b.useEffect)(()=>{let e=!1;return h(i,`diff`).then(t=>{e||o({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let s=a?.text===i?a.tokens:m(i,`diff`)?.tokens??null;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,x.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:c(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[s?.[t]===void 0?e:s[t].map((e,t)=>(0,x.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>C?(0,x.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}export{D as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,Bt as i,H as a,It as o,Ln as s,Lt as c,Qt as l,Rn as u,Rt as d,U as f,Ut as p,W as m,Yt as h,bt as g,d as _,in as v,on as ee,zn as y,zt as b}from"./queries-CPNrCEon.js";import{Bi as te,Bt as x,Ci as ne,Ti as S,Vt as re,Xi as ie,a as C,ft as ae,ha as oe,ii as w,rt as T,wn as se,xr as ce}from"./project-scope-context-_6sNMsAf.js";import{C as le,E,S as ue,_ as de,h as fe,i as pe,n as me,p as he,t as D,w as ge,x as _e}from"./reference-chip-B32qTHb5.js";import{o as O,s as k}from"./dist-CCX8mhHc.js";import{I as ve,S as ye,Y as be,Z as xe,a as Se,ct as Ce,m as we,mt as Te,o as Ee,st as De,t as Oe,u as ke,y as A}from"./design-icons-QbNMZniQ.js";import{t as j}from"./createLucideIcon-BHp8sXmF.js";import{t as Ae}from"./app-window-CSHwDX9N.js";import{n as je,r as Me,t as Ne}from"./open-in-menu-D07DgRwh.js";import{t as Pe}from"./info-DA1x_4bz.js";import{t as Fe}from"./message-square-B-MD-8rD.js";import{t as Ie}from"./square-terminal-B6RYYieR.js";import{t as M}from"./button-BV_AiLj2.js";import{a as N,i as P,l as F,n as I,p as L,r as R,t as z}from"./dropdown-menu-NJZfnQCU.js";import{n as Le,r as Re,t as ze}from"./popover-BQolmvDR.js";import{a as Be,i as Ve,o as He,r as Ue,s as We,t as Ge}from"./dialog-DKr-j9S6.js";import{c as Ke,s as qe,t as B}from"./project-router-l_pJCK5X.js";import{f as Je,m as V}from"./task-groups-Bc_WNTMe.js";import"./attention-C33sN0aA.js";import{t as H}from"./status-dot-Dvy-rnDJ.js";import{t as Ye}from"./format-BU7D3IfE.js";import{a as Xe}from"./agent-accounts-BC78GKYv.js";import{$t as Ze,Dn as U,Er as Qe,Fn as $e,G as et,Jn as tt,K as W,W as nt,Wn as rt,a as it,an as at,bn as G,dn as ot,en as st,er as ct,h as lt,hn as ut,i as dt,in as ft,ir as K,ln as pt,m as mt,mr as ht,nn as gt,nr as _t,on as vt,pr as q,rn as yt,tn as bt,tr as xt,vr as St,yn as Ct}from"./index-BAXboPqe.js";import{t as wt}from"./textarea-BGp28xFr.js";import{t as Tt}from"./markdown-D7p7x8Pe.js";import{t as Et}from"./task-file-scope-C_cr_ix-.js";import{t as J}from"./tab-link-BPkGPOYd.js";var Dt=j(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),Ot=j(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),kt=j(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),At=j(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Y=e(t(),1),X=n();function jt(e){let t=v();return y({mutationFn:t=>T(u(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>s()),onError:e=>C(e.message,{tone:`danger`})})}var Mt={archive:{full:`Archive task`,compact:`Archive`},unarchive:{full:`Unarchive`,compact:`Unarchive`}};function Nt(e){return Mt[e.archived?`unarchive`:`archive`].full}function Pt(e){return Mt[e.archived?`unarchive`:`archive`].compact}function Ft({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,X.jsx)(Ze,{open:t,onOpenChange:n,children:(0,X.jsxs)(gt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(at,{children:[(0,X.jsx)(vt,{children:`Archive task?`}),(0,X.jsxs)(yt,{children:[`Move “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:V(e),children:V(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,X.jsxs)(ft,{children:[(0,X.jsx)(bt,{children:`Cancel`}),(0,X.jsx)(st,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function It({run:e,className:t,compact:n=!1}){let[r,i]=(0,Y.useState)(!1),a=jt(e.id),o=Nt(e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(M,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:O(`gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):i(!0),children:[e.archived?(0,X.jsx)(Qe,{"aria-hidden":`true`}):(0,X.jsx)(Oe,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:n?Pt(e):o})]}),(0,X.jsx)(Ft,{run:e,open:r,onOpenChange:i,onConfirm:()=>{a.mutate(!0),i(!1)}})]})}function Lt({phone:e}){return e?(0,X.jsx)(Ee,{"aria-hidden":`true`}):null}function Rt({run:e,action:t,prUrl:n,patch:r,phone:i}){let a=t.phase===`blocked`;return{key:`completion`,heading:a?`Completion blocked`:`Completion pending`,reason:t.message||(a?`Completion needs attention.`:`Checking completion actions.`),pending:!a,actions:(0,X.jsxs)(X.Fragment,{children:[n&&k(n)?(0,X.jsx)(M,{variant:`outline`,asChild:!0,children:(0,X.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:[`Open PR`,(0,X.jsx)(Lt,{phone:i})]})}):null,e.autoMergePr?(0,X.jsx)(M,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>C(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})}}function zt({run:e,blocker:t,flags:n,phone:r}){return{key:`archive`,heading:`Archive blocked`,reason:t.message,actions:(0,X.jsxs)(X.Fragment,{children:[t.runId?(0,X.jsx)(M,{variant:`outline`,asChild:!0,children:(0,X.jsx)(B,{to:`/tasks/${t.runId}`,"aria-label":r?`Open task that blocks the archive`:void 0,children:r?`Open task`:`Open blocking task`})}):null,t.pullRequestUrl&&k(t.pullRequestUrl)?(0,X.jsx)(M,{variant:`outline`,asChild:!0,children:(0,X.jsxs)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,"aria-label":r?`Open PR that blocks the archive`:void 0,children:[r?`Open PR`:`Open blocking PR`,(0,X.jsx)(Lt,{phone:r})]})}):null,n.archive?(0,X.jsx)(It,{run:e,compact:r}):null]})}}function Bt({heading:e,reason:t,className:n,hideHeading:r}){return(0,X.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:O(`text-sm [overflow-wrap:anywhere]`,n),children:[r?(0,X.jsxs)(`span`,{className:`sr-only`,children:[e,` · `]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e}),` · `]}),t]})}function Vt({blocks:e}){return(0,X.jsx)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-card-edge bg-card p-3 shadow-card [margin-block:0.75rem]`,children:e.map(e=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(Bt,{heading:e.heading,reason:e.reason}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions})]},e.key))})}function Ht({blocks:e}){let[t,n]=(0,Y.useState)(!1),r=(0,Y.useId)(),[i]=e;if(!i)return null;let a=e.length-1;return(0,X.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`-mx-4 min-w-0 border-b border-card-edge bg-card`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`completion-status-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),className:`flex min-h-11 w-full items-center gap-2 px-4 text-start text-sm outline-hidden focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-ring/50`,children:[i.pending?(0,X.jsx)(xe,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,X.jsx)(Ce,{"aria-hidden":`true`,className:`size-4 shrink-0 text-semantic-amber`}),(0,X.jsx)(`span`,{className:`shrink-0 font-medium`,children:i.heading}),t?(0,X.jsx)(`span`,{className:`flex-1`}):(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:[`· `,i.reason]}),a>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-muted-foreground`,children:[`+`,a]}),(0,X.jsxs)(`span`,{className:`sr-only`,children:[`and `,a,` more`]})]}):null,(0,X.jsx)(ke,{"aria-hidden":`true`,className:O(`size-4 shrink-0 text-muted-foreground`,t&&`rotate-180`)})]}),(0,X.jsx)(`div`,{id:r,className:O(t&&`grid gap-2 px-4 pb-3`),children:e.map((e,n)=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(Bt,{heading:e.heading,reason:e.reason,className:O(!t&&`sr-only`),hideHeading:n===0}),t?(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions}):null]},e.key))})]})}function Ut({run:e}){let t=b(e.id),n=xt(),r=G(e),i=e.status===`done`?e.completionAction:void 0,a=r.archive?e.archiveBlocker:void 0,o=i&&i.phase!==`complete`?i:void 0;if(!o&&!a)return null;let s=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url,c=!n,l=[o?Rt({run:e,action:o,prUrl:s,patch:t,phone:c}):void 0,a?zt({run:e,blocker:a,flags:r,phone:c}):void 0].filter(e=>e!==void 0);return n?(0,X.jsx)(Vt,{blocks:l}):(0,X.jsx)(Ht,{blocks:l})}var Wt=[`running`,`queued`,`waiting`];function Gt(e,{queuePosition:t,now:n=new Date}){let r=te(e),i=$e(e,r).label,a=t===void 0?i:`${i} #${t}`,o=Wt.includes(e.status)?qt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Kt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function qt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Ye(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),C(t)}catch{C(`Run manually: ${e}`)}}function Jt(e){let t=a(),n=_(),r=(0,Y.useMemo)(()=>E(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,Y.useMemo)(()=>n===void 0?[]:r.filter(e=>he(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Yt(e){return y({mutationFn:()=>re(e.id),onError:e=>{if(e instanceof se&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}C(e.message,{tone:`danger`})}})}function Q(e,t){let n=d(),r=m(),i=g(),a=y({mutationFn:t=>x(e.id,t),onError:e=>C(e.message,{tone:`danger`})}),o=Xe(),s=w(e),c=o.runnersOn(e=>t&&s.sessionId!==void 0&&e===s.backend?s.profileId??`default`:o.repoAccount?.[e]).runners,l=e=>!r.isSuccess||!i.isSuccess||c.includes(e??`claude`);return{canResumeHere:t&&l(ut(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=je(e.id);return t===void 0||i.isSuccess&&l(t)}).map(t=>({target:t,...ot(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:a}}function Xt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=g().data,s=Ct(e);return!r&&i.length===0&&!s?null:(0,X.jsxs)(X.Fragment,{children:[r||i.length>0?(0,X.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,X.jsxs)(M,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,X.jsx)(Ie,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=Me(e,o);return(0,X.jsxs)(M,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,X.jsxs)(M,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>C(`Worktree path copied`)).catch(()=>C(`Path: ${t}`))},children:[(0,X.jsx)(A,{}),`Copy worktree path`]}):null]}):null,s?(0,X.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,X.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,X.jsxs)(M,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,X.jsx)(A,{}),`Copy resume command`]})]}):null]})}function Zt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),o=Ct(e),s=e.worktreePath;return!r&&i.length===0&&!o&&!s?null:(0,X.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,X.jsx)(Ne,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,leading:r?(0,X.jsxs)(P,{"data-target":`terminal-resume`,onSelect:n,children:[(0,X.jsx)(Ie,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,X.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void Z(s,`Worktree path copied`),children:[(0,X.jsx)(A,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,X.jsxs)(M,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,onClick:()=>void Z(o,`Command copied to clipboard.`),children:[(0,X.jsx)(A,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Qt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Q(e,t);return!a&&o.length===0?null:r?(0,X.jsx)(P,{onSelect:r,children:`Open in…`}):(0,X.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,X.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,X.jsx)(Te,{})})]}),e.worktreePath?(0,X.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(Xt,{run:e,canResume:t,onResume:n})})]})}function $t({branch:e}){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{C(`Could not copy branch. Select and copy: ${e}`)}};return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium break-all`,children:e}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,X.jsx)(A,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function en({run:e}){let t=a(),n=_(),r=r=>n===void 0?void 0:ue(n,e.id,r,t),i=(0,Y.useMemo)(()=>E(e,t),[e,t]),o=[],s=[],c=i.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,X.jsx)(D,{reference:t,to:r(t),taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,X.jsx)(pt,{run:e,prNumber:t.number})},de(t)));let l=ge(e);l&&k(l)&&!c.some(e=>e.url===l)&&o.push((0,X.jsx)(D,{reference:{kind:`PR`,url:l},taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=i.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,X.jsx)(D,{reference:t,to:r(t),taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},de(t)));let d=_e(e,t);if(d&&k(d)&&!u.some(e=>e.url===d)){let t=fe(d);s.push((0,X.jsx)(D,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:V(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,X.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,X.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function tn(){let e=qe(),t=f();return nt(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var $=e=>e.map(e=>`${e.name}: ${et(e.url)}`).join(`
|
|
2
|
+
`);function nn(e){let t=tt(),n=tn(),r=n.length>0,i=c(e.id),[a,o]=(0,Y.useState)(null),s=e.notify===!0,l=()=>i.mutate({notify:!1},{onSuccess:()=>C(`Stopped notifying the webhook`),onError:e=>C(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),u=r?(0,X.jsx)(sn,{mode:a,targets:n,pending:i.isPending,onOpenChange:e=>!e&&o(null),onSubmit:e=>i.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{o(null),C(a===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>C(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null;return{visible:t!==`absent`&&(r||s),notifying:s,reachable:r,targets:n,pending:i.isPending,open:o,stop:l,dialog:u}}function rn({run:e}){let t=nn(e);if(!t.visible)return null;let{notifying:n,reachable:r,targets:i}=t;return(0,X.jsxs)(X.Fragment,{children:[n?(0,X.jsxs)(z,{children:[(0,X.jsx)(L,{asChild:!0,children:(0,X.jsxs)(M,{variant:`outline`,"data-slot":`notifying-chip`,className:`gap-1.5`,"aria-label":r?`Notifying ${W(i)} — webhook actions`:`Notifying — webhook actions`,title:r?$(i):void 0,children:[(0,X.jsx)(H,{tone:`success`}),(0,X.jsx)(`span`,{children:`Notifying`}),(0,X.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,X.jsxs)(R,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[r?(0,X.jsx)(N,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-xs font-normal text-muted-foreground`,children:i.map(e=>(0,X.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:et(e.url),children:e.name},e.id))}):null,r?(0,X.jsxs)(P,{className:`min-h-11`,onSelect:()=>t.open(`note`),children:[(0,X.jsx)(Fe,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,X.jsxs)(P,{variant:`destructive`,className:`min-h-11`,disabled:t.pending,onSelect:t.stop,children:[(0,X.jsx)(Dt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,X.jsxs)(M,{variant:`outline`,"data-action":`handoff`,className:`max-md:px-0`,"aria-label":`Hand off to webhook`,onClick:()=>t.open(`handoff`),children:[(0,X.jsx)(q,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),t.dialog]})}function an({handoff:e}){if(!e.visible)return null;let{notifying:t,reachable:n,targets:r}=e;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(F,{}),(0,X.jsx)(N,{"data-slot":`handoff-menu-label`,className:`truncate px-2 py-3 text-[12px] font-normal text-muted-foreground uppercase`,title:n?$(r):void 0,children:n?`Webhook · ${W(r)}`:`Webhook`}),t?(0,X.jsxs)(X.Fragment,{children:[n?(0,X.jsx)(P,{"data-action":`handoff-note`,className:`min-h-11`,onSelect:()=>e.open(`note`),children:`Send a note…`}):null,(0,X.jsx)(P,{"data-action":`handoff-stop`,variant:`destructive`,className:`min-h-11`,disabled:e.pending,onSelect:e.stop,children:`Stop notifying`})]}):(0,X.jsx)(P,{"data-action":`handoff`,className:`min-h-11`,onSelect:()=>e.open(`handoff`),children:`Hand off to webhook…`})]})}function on({run:e}){let t=tt(),n=tn();return e.notify!==!0||t===`absent`?null:(0,X.jsx)(K,{"data-slot":`notifying-status`,role:`img`,"aria-label":n.length>0?`Notifying ${W(n)}`:`Notifying`,title:n.length>0?$(n):void 0,className:`shrink-0 px-2 py-px leading-4`,children:(0,X.jsx)(q,{"aria-hidden":`true`,className:`size-3 text-success`})})}function sn({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,Y.useId)(),o=(0,Y.useId)(),[s,c]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=W(t);return(0,X.jsx)(Ge,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,X.jsx)(Ue,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,X.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,X.jsxs)(He,{className:`text-left`,children:[(0,X.jsx)(We,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,X.jsx)(Ve,{children:(0,X.jsx)(`span`,{"data-webhook-destination":``,title:$(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,X.jsx)(wt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,X.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,X.jsx)(Pe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,X.jsxs)(Be,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:w-full`,children:[(0,X.jsx)(M,{type:`button`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,X.jsxs)(M,{type:`submit`,variant:`contrast`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,X.jsx)(q,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function cn({id:e}){return(0,X.jsxs)(B,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,X.jsx)(Se,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function ln({id:e}){let t=p(e),n=t.data?V(t.data):e;return(0,X.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,X.jsxs)(B,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,X.jsx)(Se,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,X.jsx)(M,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var un=3,dn=(e,t)=>e.kind===t.kind&&e.number===t.number;function fn(e,t,n=un){let r=t?e.findIndex(e=>dn(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var pn=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function mn({tab:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(e.kind===`pr`?ve:we,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,X.jsx)(me,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function hn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function gn({servers:e,icon:t=!1}){let n=mt();if(n===null)return null;let r=n.agentLive===!0,i=e[0],a=e.length+ +!!r,o=a===1?i?{port:i.port}:{agent:!0}:{};return t?(0,X.jsxs)(M,{variant:`ghost`,size:`icon`,"data-slot":`preview-toggle`,"data-entries":a,"aria-pressed":n.open,"aria-label":hn(e,r),className:O(`relative`,a>0?`text-foreground`:`text-soft-foreground`),onClick:()=>n.openPane(o),children:[(0,X.jsx)(Ae,{"aria-hidden":`true`}),n.live?(0,X.jsx)(H,{tone:`success`,"aria-hidden":`true`,"data-slot":`preview-live-dot`,className:`absolute top-2 right-2`}):null]}):(0,X.jsxs)(M,{variant:`outline`,"data-slot":`preview-toggle`,"aria-pressed":n.open,onClick:()=>n.openPane(o),children:[(0,X.jsx)(Ae,{"aria-hidden":`true`}),hn(e,r),n.live?(0,X.jsx)(H,{tone:`success`,"aria-label":`Preview is live`}):null]})}function _n({tab:e}){let t=lt();return!t?.available||e!==`session`&&e!==`changes`?null:(0,X.jsxs)(M,{variant:`outline`,"data-slot":`split-view-toggle`,className:O(t.showing&&`border-accent-text/40 bg-muted text-accent-text`),"aria-pressed":t.showing,title:t.showing?`Show Session alone`:`Show Changes beside Session`,onClick:()=>t.setOn(!t.showing),children:[(0,X.jsx)(kt,{"aria-hidden":`true`}),`Split view`]})}function vn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function yn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,X.jsx)(cn,{id:n}):(0,X.jsx)(ln,{id:n})}function bn({isDesktop:e,desktopActivitySlot:t,attention:n,statusLine:r,hostOffline:i}){return e&&t?(0,X.jsx)(X.Fragment,{children:t}):(0,X.jsx)(`span`,{"data-slot":`run-status-slot`,className:`hidden`,children:(0,X.jsx)(K,{dot:n.tone,shape:n.shape,pulse:n.pulse&&!i,children:Kt(r)})})}function xn(e,t,n){return e.worktreePath&&t?(0,X.jsx)(gn,{servers:e.previewServers??[],icon:n}):null}function Sn(e,t,n){return n&&!e.archiveBlocker&&t.archive?(0,X.jsx)(It,{run:e}):null}function Cn({offline:e,className:t}){return e?(0,X.jsx)(K,{"data-slot":`host-not-live-pill`,dot:`neutral`,shape:`ring`,className:t,children:`Not live`}):null}function wn({archived:e,className:t}){return e?(0,X.jsx)(K,{"data-slot":`run-archived-pill`,dot:U.tone,shape:U.shape,className:t,children:U.label}):null}function Tn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,X.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function En({run:e,statusLine:t,activityTrigger:n,hostOffline:r}){let{attention:i}=t;return(0,X.jsx)(`span`,{"data-slot":`mobile-status-room`,className:`flex min-w-0`,children:(0,X.jsxs)(`span`,{className:`inline-flex max-w-full min-w-0 items-center gap-1.5`,children:[n??(0,X.jsx)(K,{"data-slot":`mobile-run-status`,dot:i.tone,shape:i.shape,pulse:i.pulse&&!r,className:`min-w-0 px-2 py-px text-xs leading-4`,children:(0,X.jsx)(`span`,{className:`truncate`,children:t.label})}),(0,X.jsx)(Cn,{offline:r,className:`shrink-0 px-2 py-px text-xs leading-4`}),(0,X.jsx)(wn,{archived:e.archived,className:`shrink-0 px-2 py-px text-xs leading-4`}),(0,X.jsx)(on,{run:e})]})})}function Dn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,Y.useRef)(null),[c,l]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let e=s.current;if(!e||o){l(!1);return}let t=()=>l(e.scrollWidth-e.clientWidth-e.scrollLeft>1),n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{n.disconnect(),e.removeEventListener(`scroll`,t)}},[o,r,i,e.diffStat?.files]);let u=n?`${n.kind}#${n.number}`:null;return(0,Y.useEffect)(()=>{!u||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[u,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,X.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,"data-overflow-end":c||void 0,className:O(`flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-2 max-md:[&>a]:text-[13.5px]`,a?`mt-0`:`mt-3`),children:[(0,X.jsx)(J,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,X.jsx)(J,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,X.jsx)(J,{to:pn(e.id,t),active:n!==null&&dn(t,n),replace:a,children:(0,X.jsx)(mn,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,X.jsxs)(z,{children:[(0,X.jsxs)(L,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,X.jsx)(R,{align:`end`,children:i.map(t=>(0,X.jsx)(P,{asChild:!0,children:(0,X.jsx)(B,{to:pn(e.id,t),replace:a,children:(0,X.jsx)(mn,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function On({run:e,tab:t=`session`,onMarkedUnread:n,desktopActivitySlot:i,mobileActivitySlot:a}){let o=te(e),s=G(e),[c,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),p=kn(e,n),m=An(e),h=(0,Y.useRef)(null),g=l(),_=r(),v=Gt(e,{queuePosition:e.status===`queued`?Je(g.data??[]).get(e.id):void 0}),ee=_t(),y=xt(),b=ee!==null&&!y?ee:null,x=b!==null,{referenceProjectId:ne,repoBase:S,requests:re}=Jt(e),ie=(0,Y.useMemo)(()=>le(e,S),[e,S]),C=typeof t==`object`?t:null,{inline:ae,overflow:oe}=fn(ie,C),w=rt(_.data),T=ce(),se=xn(e,w,!1),E=(0,X.jsx)(Nn,{run:e,actions:p,triggerRef:h,onRename:x?m.editor.begin:void 0,onOpenChooser:()=>f(!0),onToggleNotes:()=>u(e=>!e)}),ue=Sn(e,s,y);return(0,X.jsx)(pe,{projectId:ne,repoBase:S,requests:re,children:(0,X.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:O(`relative z-20 shrink-0 bg-background px-4 md:px-9 md:pt-7`,x?`pt-0`:`pt-[18px]`,t===`session`&&`border-b border-border`),children:[(0,X.jsx)(Tn,{run:e}),(0,X.jsx)(Ut,{run:e}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(yn,{run:e}),b?(0,X.jsxs)(ct,{slot:b,children:[(0,X.jsx)(Mn,{run:e,title:m,returnFocus:h,status:(0,X.jsx)(En,{run:e,statusLine:v,activityTrigger:a,hostOffline:T})}),xn(e,w,!0),(0,X.jsx)(yn,{run:e,compact:!0}),E]}):(0,X.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,X.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:vn(e.delegation)}),(0,X.jsx)(jn,{run:e}),(0,X.jsx)(bn,{isDesktop:y,desktopActivitySlot:i,attention:o,statusLine:v,hostOffline:T}),(0,X.jsx)(Cn,{offline:T,className:`max-md:hidden`}),(0,X.jsx)(wn,{archived:e.archived,className:`max-md:hidden`}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[ue,(0,X.jsx)(_n,{tab:t}),se,(0,X.jsx)(rn,{run:e}),E]})]}),(0,X.jsx)(Dn,{run:e,tab:t,activeItem:C,inlineItemTabs:ae,overflowItemTabs:oe,phoneBar:x,isDesktop:y}),c?(0,X.jsx)(In,{runId:e.id,onClose:()=>u(!1)}):null,d?(0,X.jsx)(Qt,{run:e,canResume:G(e).terminal,onResume:()=>p.terminal.mutate(),onClose:()=>f(!1)}):null]}),(0,X.jsx)(Fn,{run:e,actions:p})]})})}function kn(e,t){let n=oe(),r=Ke(),[a,s]=(0,Y.useState)(null),c=()=>n.invalidateQueries({queryKey:ee.runs.all}),l=e=>C(e.message,{tone:`danger`}),u=i(),d={isPending:u.isPending,mutate:()=>u.mutate({id:e.id,pinned:!e.pinned})},f=o();return{pin:d,markUnread:{isPending:f.isPending,mutate:()=>{t?.(),f.mutate(e.id,{onError:l})}},delete:y({mutationFn:()=>ae(e.id),onSuccess:()=>{c(),r(`/`)},onError:l}),terminal:Yt(e),confirming:a,setConfirming:s}}function An(e){let t=b(e.id),n=V(e);return{title:n,editor:it(n,e=>t.mutate({title:e},{onError:e=>C(e.message,{tone:`danger`})}))}}function jn({run:e}){let{title:t,editor:n}=An(e);return n.editing?(0,X.jsx)(dt,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,X.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(ht,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Mn({run:e,title:{title:t,editor:n},returnFocus:r,status:i}){return(0,X.jsxs)(ze,{open:n.editing,onOpenChange:e=>{e||n.commit()},children:[(0,X.jsx)(Le,{asChild:!0,children:(0,X.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:t}),i]})}),(0,X.jsx)(Re,{align:`start`,sideOffset:12,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},onCloseAutoFocus:e=>{e.preventDefault(),r.current?.focus()},children:(0,X.jsx)(dt,{editor:n,className:`text-[16px] font-semibold`})})]})}function Nn({run:e,actions:t,triggerRef:n,onRename:r,onToggleNotes:i,onOpenChooser:a}){let o=G(e),s=Ct(e),c=xt(),l=jt(e.id),[u,d]=(0,Y.useState)(!1),f=b(e.id),p=(0,Y.useId)(),m=nn(e),h=(0,Y.useRef)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ft,{run:e,open:u,onOpenChange:d,onConfirm:()=>{l.mutate(!0),d(!1)}}),c?null:m.dialog,(0,X.jsxs)(z,{children:[(0,X.jsx)(L,{asChild:!0,children:(0,X.jsx)(M,{ref:n,variant:`ghost`,size:`icon`,"aria-label":`Run actions`,children:(0,X.jsx)(ye,{"aria-hidden":`true`})})}),(0,X.jsxs)(R,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,onCloseAutoFocus:e=>{h.current&&(h.current=!1,e.preventDefault(),r?.())},children:[(0,X.jsx)(N,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),r?(0,X.jsxs)(P,{"data-action":`rename-task`,className:`min-h-11`,onSelect:()=>{h.current=!0},children:[(0,X.jsx)(ht,{"aria-hidden":`true`}),` Rename`]}):null,!c&&o.archive&&!e.archiveBlocker?(0,X.jsx)(P,{disabled:l.isPending,onSelect:()=>e.archived?l.mutate(!1):d(!0),children:Nt(e)}):null,(0,X.jsxs)(P,{onSelect:i,children:[(0,X.jsx)(St,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,X.jsx)(Qt,{run:e,canResume:o.terminal,onResume:()=>t.terminal.mutate(),onOpen:a}),s?(0,X.jsxs)(P,{onSelect:()=>void Z(s,`Command copied to clipboard.`),children:[(0,X.jsx)(A,{"aria-hidden":`true`}),` Copy resume command`]}):null,o.markUnread?(0,X.jsxs)(P,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,X.jsx)(Ot,{"aria-hidden":`true`}),` Mark unread`]}):null,o.pin?(0,X.jsxs)(I,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,X.jsx)(At,{"aria-hidden":`true`}):(0,X.jsx)(be,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,c?null:(0,X.jsx)(an,{handoff:m}),(0,X.jsx)(F,{}),(0,X.jsx)(N,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,X.jsx)(I,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:f.isPending,onCheckedChange:e=>f.mutate({archiveWhenDone:e},{onError:e=>C(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,X.jsx)(I,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:f.isPending,"aria-describedby":p,onCheckedChange:e=>f.mutate({autoMergePr:e},{onError:e=>C(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,X.jsx)(`p`,{id:p,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,X.jsx)(Pn,{run:e,patch:f}),o.deleteRun?(0,X.jsx)(F,{}):null,o.deleteRun?(0,X.jsxs)(P,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,X.jsx)(De,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function Pn({run:e,patch:t}){let n=(0,Y.useId)(),r=(0,Y.useId)(),i=(0,Y.useId)(),a=e=>C(e.message,{tone:`danger`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(F,{}),(0,X.jsx)(N,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,X.jsx)(I,{"data-slot":`allow-workers`,className:`min-h-11`,checked:S(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,X.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,X.jsx)(I,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:ne(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,X.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,X.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function Fn({run:e,actions:t}){let n=t.confirming;return(0,X.jsx)(Ze,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,X.jsxs)(gt,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,X.jsxs)(at,{children:[(0,X.jsx)(vt,{className:`text-danger`,children:`Delete task permanently?`}),(0,X.jsx)(yt,{children:(0,X.jsxs)(X.Fragment,{children:[`Delete “`,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,title:V(e),children:V(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!ie(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,X.jsxs)(ft,{children:[(0,X.jsx)(bt,{children:`Cancel`}),(0,X.jsx)(st,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function In({runId:e,onClose:t}){let n=h(e);return(0,X.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 flex max-h-[min(45dvh,420px)] flex-col overflow-hidden rounded-xl border border-border bg-card p-6`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,X.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,X.jsx)(Te,{})})]}),(0,X.jsx)(`div`,{"data-slot":`notes-panel-body`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n.isPending?(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,X.jsx)(Et,{runId:e,children:(0,X.jsx)(Tt,{children:n.data})}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})}),(0,X.jsxs)(`div`,{className:`mt-4 flex shrink-0 gap-3`,children:[(0,X.jsx)(M,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,X.jsx)(M,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{Yt as a,Zt as i,$t as n,Jt as o,en as r,Gt as s,On as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{a as i,n as a,o}from"./dist-CCX8mhHc.js";import{f as s,l as c,u as l}from"./design-icons-QbNMZniQ.js";import{a as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,t as S,u as C}from"./es2015-BHonSvOU.js";import{n as w,t as T}from"./dist-B2_vvox1.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-Du6flkGD.js";import{dr as ee}from"./index-D0RESQCN.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=w(R),[H,U]=_(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:p,required:m,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,b]=M.useState(null),[x,S]=M.useState(null),[C,w]=M.useState(!1),E=T(l),[D,k]=f({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=f({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=g(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:p,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=W(n),s=G(ae,n),c=s.disabled||r,l=i(t,s.onTriggerChange),u=B(n),d=M.useRef(`touch`),[f,p,h]=$e(e=>{let t=u().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...o,children:(0,F.jsx)(m.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...a,ref:l,onClick:b(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:b(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:b(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(g(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=G(se,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=i(t,l.onValueNodeChange);p(()=>{u(d)},[u,d]);let h=$(l.value);return(0,F.jsx)(m.span,{...c,asChild:!h&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?s:o},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(m.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(h,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return p(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(C,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=a(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C,...w}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=i(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return S(E)},[E]),x();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(v,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(u,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:b(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:b(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=G(J,n),s=X(J,n),[c,l]=M.useState(null),[u,d]=M.useState(null),f=i(t,d),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=M.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=h(),s=window.innerHeight-Y*2,l=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),m=parseInt(d.borderBottomWidth,10),_=parseInt(d.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,c,u,v,y,b,o.dir,r]);p(()=>S(),[S]);let[C,w]=M.useState();return p(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,F.jsx)(Te,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(m.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=X(De,n),s=Ee(De,n),c=i(t,o.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(m.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:b(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=g();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(m.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(m.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...s}=e,c=G(Z,n),l=X(Z,n),u=c.value===r,[f,p]=M.useState(o??``),[h,_]=M.useState(!1),v=i(t,d(e=>l.itemRefCallback?.(e,r,a))),y=g(),x=M.useRef(`touch`),S=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:a,textId:y,isSelected:u,onItemTextChange:M.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:(0,F.jsx)(m.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":u&&h,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:b(s.onFocus,()=>_(!0)),onBlur:b(s.onBlur,()=>_(!1)),onClick:b(s.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:b(s.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:b(s.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:b(s.onPointerMove,e=>{x.current=e.pointerType,a?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:b(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:b(s.onKeyDown,e=>{a||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...o}=e,s=G(Q,n),c=X(Q,n),l=Ie(Q,n),u=re(Q,n),[f,h]=M.useState(null),g=d(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),_=i(t,h,l.onItemTextChange,g),v=f?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=u;return p(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(m.span,{id:l.textId,...o,ref:_}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?N.createPortal(o.children,s.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(m.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),p(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(m.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:b(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:b(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:b(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(m.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,h=M.useRef(null),g=i(n,h),_=a??``,v=E(_),y=Array.from(f).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(m.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(a)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=d(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:o(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(l,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:o(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:o(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:o(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(c,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(l,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{a as i,n as a,o}from"./dist-CCX8mhHc.js";import{f as s,l as c,u as l}from"./design-icons-QbNMZniQ.js";import{a as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,t as S,u as C}from"./es2015-BHonSvOU.js";import{n as w,t as T}from"./dist-B2_vvox1.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-Du6flkGD.js";import{dr as ee}from"./index-BAXboPqe.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=w(R),[H,U]=_(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:p,required:m,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,b]=M.useState(null),[x,S]=M.useState(null),[C,w]=M.useState(!1),E=T(l),[D,k]=f({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=f({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=g(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:p,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=W(n),s=G(ae,n),c=s.disabled||r,l=i(t,s.onTriggerChange),u=B(n),d=M.useRef(`touch`),[f,p,h]=$e(e=>{let t=u().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...o,children:(0,F.jsx)(m.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...a,ref:l,onClick:b(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:b(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:b(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(g(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=G(se,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=i(t,l.onValueNodeChange);p(()=>{u(d)},[u,d]);let h=$(l.value);return(0,F.jsx)(m.span,{...c,asChild:!h&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?s:o},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(m.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(h,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return p(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(C,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=a(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C,...w}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=i(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return S(E)},[E]),x();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(v,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(u,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:b(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:b(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=G(J,n),s=X(J,n),[c,l]=M.useState(null),[u,d]=M.useState(null),f=i(t,d),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=M.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=h(),s=window.innerHeight-Y*2,l=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),m=parseInt(d.borderBottomWidth,10),_=parseInt(d.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,c,u,v,y,b,o.dir,r]);p(()=>S(),[S]);let[C,w]=M.useState();return p(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,F.jsx)(Te,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(m.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=X(De,n),s=Ee(De,n),c=i(t,o.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(m.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:b(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=g();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(m.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(m.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...s}=e,c=G(Z,n),l=X(Z,n),u=c.value===r,[f,p]=M.useState(o??``),[h,_]=M.useState(!1),v=i(t,d(e=>l.itemRefCallback?.(e,r,a))),y=g(),x=M.useRef(`touch`),S=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:a,textId:y,isSelected:u,onItemTextChange:M.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:(0,F.jsx)(m.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":u&&h,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:b(s.onFocus,()=>_(!0)),onBlur:b(s.onBlur,()=>_(!1)),onClick:b(s.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:b(s.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:b(s.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:b(s.onPointerMove,e=>{x.current=e.pointerType,a?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:b(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:b(s.onKeyDown,e=>{a||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...o}=e,s=G(Q,n),c=X(Q,n),l=Ie(Q,n),u=re(Q,n),[f,h]=M.useState(null),g=d(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),_=i(t,h,l.onItemTextChange,g),v=f?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=u;return p(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(m.span,{id:l.textId,...o,ref:_}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?N.createPortal(o.children,s.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(m.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),p(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(m.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:b(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:b(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:b(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(m.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,h=M.useRef(null),g=i(n,h),_=a??``,v=E(_),y=Array.from(f).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(m.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(a)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=d(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:o(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(l,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:o(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:o(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:o(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(c,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(l,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};
|
package/web/dist/assets/{session-context-section-D02yRmGY.js → session-context-section-CxFRidmv.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,E as i,x as a}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,E as i,x as a}from"./queries-CPNrCEon.js";import{wn as o}from"./project-scope-context-_6sNMsAf.js";import{o as s}from"./dist-CCX8mhHc.js";import{t as c}from"./plus-CxRU2X8C.js";import{t as l}from"./button-BV_AiLj2.js";import{t as u}from"./badge-DAnkqD7i.js";import{t as d}from"./centered-state-N8vWM_Hw.js";import{sr as f,yr as p}from"./index-BAXboPqe.js";import{t as m}from"./code-editor-DZMD1guX.js";import{r as h}from"./settings-save-bar-DzbndGGQ.js";var g=e(t(),1);function _(e,t,n){let r=e.indexOf(t),i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(!(i[n]===void 0||r===-1))return e[(r+i[n]+e.length)%e.length]}var v=n(),y={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},b={"built-in":`built in`,shared:`shared`,local:`local`},x={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},S=e=>`${e.toLocaleString(`en-US`)} B`;function ee({id:e,preview:t,role:n,onRole:r,pending:i,className:a}){return(0,v.jsxs)(`section`,{id:e,"data-slot":`session-context-preview`,"aria-labelledby":`session-context-preview-title`,"aria-busy":i,className:s(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,a),children:[(0,v.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Combined preview`}),(0,v.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,v.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,v.jsx)(te,{role:n,onRole:r}),(0,v.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Handoff, shared, then local. Files come from the project checkout.`})]}),t?(0,v.jsx)(ne,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,v.jsx)(`div`,{className:`h-[38px]`})]}),(0,v.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,v.jsx)(w,{block:e,role:n},`${e.source}-${e.id}-${t}`))})]})}var C=[`parent`,`worker`];function te({role:e,onRole:t}){let n=(0,g.useRef)(new Map);return(0,v.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=_(C,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`inline-flex overflow-hidden rounded-md border border-[var(--control-border)]`,children:C.map(r=>(0,v.jsx)(`button`,{ref:e=>{e?n.current.set(r,e):n.current.delete(r)},type:`button`,role:`radio`,"aria-checked":e===r,tabIndex:e===r?0:-1,"data-slot":`session-context-role`,onClick:()=>t(r),className:s(`min-h-11 px-4 text-[13px] capitalize text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,e===r&&`bg-muted text-foreground`),children:r},r))})}function ne({used:e,limit:t,blocks:n}){let r=n.filter(e=>e.status===`applied`).length,i=n.filter(e=>e.status===`skipped`).length,a=Math.min(100,e/t*100);return(0,v.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,v.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${S(e)} of ${S(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,v.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,v.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,v.jsxs)(`span`,{className:`text-muted-foreground`,children:[S(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,v.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,S(t),`)`]})]})]})}function w({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status,r=e.overridesShared?`local · overrides shared`:b[e.source],i=e.source===`built-in`||e.overridesShared,a=e.reason!==null&&!(e.status===`applied`&&e.overridesShared);return(0,v.jsxs)(`li`,{"data-slot":`session-context-block`,"data-status":e.status,"data-source":e.source,className:`flex flex-col gap-1.5 p-3`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),(0,v.jsx)(u,{"data-slot":`session-context-source`,variant:`outline`,className:s(`text-xs`,i&&`border-accent-strong/40 text-link-foreground`),children:r}),e.target&&e.target!==`built-in`&&(0,v.jsx)(u,{variant:`outline`,className:`text-xs`,children:y[e.target]}),(0,v.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:S(e.bytes)}),(0,v.jsx)(u,{variant:`outline`,className:s(`text-xs`,x[e.status]),children:n})]}),a&&(0,v.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,v.jsxs)(`pre`,{tabIndex:0,"aria-label":`${e.id} text`,className:`max-h-28 overflow-auto rounded-md bg-background px-2.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[e.text,e.truncated?`
|
|
2
2
|
…`:``]})]})}var re=Symbol.for(`yaml.alias`),ie=Symbol.for(`yaml.document`),T=Symbol.for(`yaml.map`),ae=Symbol.for(`yaml.pair`),E=Symbol.for(`yaml.scalar`),D=Symbol.for(`yaml.seq`),O=Symbol.for(`yaml.node.type`),k=e=>!!e&&typeof e==`object`&&e[O]===re,oe=e=>!!e&&typeof e==`object`&&e[O]===ie,A=e=>!!e&&typeof e==`object`&&e[O]===T,j=e=>!!e&&typeof e==`object`&&e[O]===ae,M=e=>!!e&&typeof e==`object`&&e[O]===E,se=e=>!!e&&typeof e==`object`&&e[O]===D;function N(e){if(e&&typeof e==`object`)switch(e[O]){case T:case D:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[O]){case re:case T:case E:case D:return!0}return!1}var ce=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),le=Symbol(`skip children`),I=Symbol(`remove node`);function ue(e,t){let n=me(t);oe(e)?de(null,e.contents,n,Object.freeze([e]))===I&&(e.contents=null):de(null,e,n,Object.freeze([]))}ue.BREAK=F,ue.SKIP=le,ue.REMOVE=I;function de(e,t,n,r){let i=he(e,t,n,r);if(P(i)||j(i))return ge(e,r,i),de(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=de(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===I&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=de(`key`,t.key,n,r);if(e===F)return F;e===I&&(t.key=null);let i=de(`value`,t.value,n,r);if(i===F)return F;i===I&&(t.value=null)}}return i}async function fe(e,t){let n=me(t);oe(e)?await pe(null,e.contents,n,Object.freeze([e]))===I&&(e.contents=null):await pe(null,e,n,Object.freeze([]))}fe.BREAK=F,fe.SKIP=le,fe.REMOVE=I;async function pe(e,t,n,r){let i=await he(e,t,n,r);if(P(i)||j(i))return ge(e,r,i),pe(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await pe(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===I&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=await pe(`key`,t.key,n,r);if(e===F)return F;e===I&&(t.key=null);let i=await pe(`value`,t.value,n,r);if(i===F)return F;i===I&&(t.value=null)}}return i}function me(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function he(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(A(t))return n.Map?.(e,t,r);if(se(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(k(t))return n.Alias?.(e,t,r)}function ge(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(oe(r))r.contents=n;else{let e=k(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var _e={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ve=e=>e.replace(/[!,[\]{}]/g,e=>_e[e]),L=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ve(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&P(e.contents)){let t={};ue(e.contents,(e,n)=>{P(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
3
3
|
`)}};L.defaultYaml={explicit:!1,version:`1.2`},L.defaultTags={"!!":`tag:yaml.org,2002:`};function ye(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function be(e){let t=new Set;return ue(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function xe(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Se(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=be(e);let a=xe(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(M(t.node)||N(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function R(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=R(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=R(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=R(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=R(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function z(e,t,n){if(Array.isArray(e))return e.map((e,t)=>z(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ce(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ce=class{constructor(e){Object.defineProperty(this,O,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!oe(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=z(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?R(i,{"":o},``,o):o}},we=class extends Ce{constructor(e){super(re),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ue(e,{Node:(e,t)=>{(k(t)||ce(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(z(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Te(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ye(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Te(e,t,n){if(k(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(N(t)){let r=0;for(let i of t.items){let t=Te(e,i,n);t>r&&(r=t)}return r}else if(j(t)){let r=Te(e,t.key,n),i=Te(e,t.value,n);return Math.max(r,i)}return 1}var Ee=e=>!e||typeof e!=`function`&&typeof e!=`object`,B=class extends Ce{constructor(e){super(E),this.value=e}toJSON(e,t){return t?.keep?this.value:z(this.value,e,t)}toString(){return String(this.value)}};B.BLOCK_FOLDED=`BLOCK_FOLDED`,B.BLOCK_LITERAL=`BLOCK_LITERAL`,B.PLAIN=`PLAIN`,B.QUOTE_DOUBLE=`QUOTE_DOUBLE`,B.QUOTE_SINGLE=`QUOTE_SINGLE`;var De=`tag:yaml.org,2002:`;function Oe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ke(e,t,n){if(oe(e)&&(e=e.contents),P(e))return e;if(j(e)){let t=n.schema[T].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new we(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=De+t.slice(2));let l=Oe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new B(e);return c&&(c.node=t),t}l=e instanceof Map?o[T]:Symbol.iterator in Object(e)?o[D]:o[T]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new B(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ae(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ke(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var je=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Me=class extends Ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(je(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(N(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:N(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return N(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ne=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function V(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var H=(e,t,n)=>e.endsWith(`
|
|
4
4
|
`)?V(n,t):n.includes(`
|
package/web/dist/assets/{settings-agent-picker-GPhOc6Lz.js → settings-agent-picker-Cy_ZpuNd.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,bt as i,gt as a,mt as o,sn as s,
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,bt as i,gt as a,mt as o,sn as s,zn as c}from"./queries-CPNrCEon.js";import{Mn as l,Tn as u,ha as d,ia as f,zn as p}from"./project-scope-context-_6sNMsAf.js";import{o as m}from"./dist-CCX8mhHc.js";import{ot as h,u as g}from"./design-icons-QbNMZniQ.js";import{t as _}from"./button-BV_AiLj2.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-DKr-j9S6.js";import{lr as w}from"./index-BAXboPqe.js";var T=e(t(),1),E=n();function D(e,t){return o(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.configDir?e.exists?e.configDir:`${e.configDir} — folder not created yet`:e.exists?``:`Not initialized on host yet`,missing:!e.exists,...e.isDefault||e.status===void 0?{}:{accountStatus:e.status.status}}))})}var O=(e,t)=>e.length>a(t).length;function k(e,t,n){let r=p(e.data,t),i=r!==void 0&&r.status!==`not-installed`&&(n??r.status)===`connected`,a=!e.isPending&&!e.isError&&r?.enabled===!0&&i;return{providerConnected:a,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:r?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:a?void 0:`Connect this provider before selecting it.`}}function A({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:a=!1,accountDisabled:o=!1,onPick:s}){let c=i().data,l=c===void 0,u=O(e,c);return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:m(`gap-0.5 rounded-md border border-border bg-card p-0.5`,u?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(i=>{let{providerConnected:c,providerReason:d}=k(r,i.runner.id,i.accountStatus),f=e.filter(e=>e.runner.id===i.runner.id).length>1,p=i.runner.id===t&&i.account===n(i.runner.id);return(0,E.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":i.runner.id,"data-account":i.account??``,title:d??i.desc,disabled:a||l||!c||f&&o,onClick:()=>s(i.runner.id,i.account,f),className:m(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,p?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[i.label,u?(0,E.jsx)(`span`,{"data-slot":i.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":i.runner.id,className:`ml-2 font-sans text-xs text-soft-foreground`,children:i.desc}):null]},`${i.runner.id}:${i.account??``}`)})})}async function j(e,t){return l(await u.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function M(e){return l(await u.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function N(e,t){return l(await u.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function P(e){return l(await u.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function F(e,t){let n=d(),[r,i]=(0,T.useState)(!1),[a,o]=(0,T.useState)(null),[l,u]=(0,T.useState)(``),p=(0,T.useRef)(null),m=(0,T.useRef)(!0),h=(0,T.useRef)(0),g=()=>{h.current++,v.current=!1;let e=p.current;p.current=null,e?.state===`waiting`&&P(e.id).catch(()=>{}),o(null),u(``),i(!1)};(0,T.useEffect)(()=>(m.current=!0,()=>{m.current=!1,h.current++;let e=p.current;e?.state===`waiting`&&P(e.id).catch(()=>{})}),[]);let _=c({mutationFn:n=>j(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!m.current||!v.current||t!==h.current){P(e.id).catch(()=>{});return}p.current=e,o(e)}}),v=(0,T.useRef)(r);v.current=r;let y=f({queryKey:[`browser-sign-in`,a?.id],queryFn:()=>M(a.id),enabled:r&&a?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),b=y.data??a,x=c({mutationFn:()=>N(a.id,l),retry:!1,onSuccess:()=>{u(``),y.refetch()}});return(0,T.useEffect)(()=>{b?.state===`connected`&&(p.current=b,o(b),Promise.all([n.invalidateQueries({queryKey:s.agentProfiles}),n.invalidateQueries({queryKey:s.providerStatus}),n.invalidateQueries({queryKey:s.models(e)})]))},[b,n,e]),{open:r,result:b,redirect:l,setRedirect:u,start:_,replay:x,status:y,error:_.error??x.error??y.error,close:g,connect:()=>{i(!0),v.current=!0,_.reset(),x.reset(),_.mutate(++h.current)}}}function I(){return`Open the sign-in link in your browser. After Google consent, the page shows a code. Copy that code, or the full address of that page, and paste it below.`}function L({provider:e,profileId:t,label:n}){let{open:i,result:a,redirect:o,setRedirect:s,start:c,replay:l,status:u,error:d,close:f,connect:p}=F(e,t);return r().data?.capabilities?.settingsAdmin===!0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:c.isPending,onClick:p,children:`Connect`}),(0,E.jsx)(C,{open:i,onOpenChange:e=>{e||f()},children:(0,E.jsxs)(x,{children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(S,{children:[`Sign in to `,n]}),(0,E.jsx)(y,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),c.isPending?(0,E.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,a?.state===`waiting`?(0,E.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,E.jsx)(`a`,{href:a.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,E.jsx)(I,{})}),(0,E.jsxs)(`label`,{className:`grid gap-2`,children:[`Code or page address`,(0,E.jsx)(w,{type:`text`,autoComplete:`off`,spellCheck:!1,value:o,onChange:e=>s(e.target.value)})]}),(0,E.jsx)(_,{disabled:!o.trim()||l.isPending,onClick:()=>l.mutate(),children:`Complete sign-in`})]}):null,a?.state===`connected`?(0,E.jsx)(`p`,{role:`status`,children:`Connected.`}):null,a?.state===`failed`?(0,E.jsx)(`p`,{role:`alert`,children:a.error}):null,a?.state===`cancelled`?(0,E.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,d?(0,E.jsx)(`p`,{role:`alert`,children:d.message}):null,u.isError&&a?.state===`waiting`?(0,E.jsx)(_,{onClick:()=>void u.refetch(),children:`Retry status`}):null,(0,E.jsx)(v,{children:(0,E.jsx)(_,{variant:`outline`,onClick:f,children:a?.state===`connected`?`Done`:`Cancel`})})]})})]}):null}function R(e){let t=e.label.startsWith(e.runner.pickerLabel)?e.label.slice(e.runner.pickerLabel.length):``;return{...e,label:`${e.runner.displayName}${t}`}}function z(e){let t=(0,T.useRef)(null),n=e.rows.map(R),r=n.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id)),i=n.find(t=>t.runner.id===e.runner)?.runner.displayName;return(0,E.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,E.jsxs)(`summary`,{children:[(0,E.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:r?.label??i??e.runner}),(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,E.jsx)(A,{...e,rows:n,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}export{k as a,O as i,L as n,D as r,z as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{g as r}from"./host-context-KsSKxKbI.js";import{t as i}from"./button-BV_AiLj2.js";import{wn as a}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{g as r}from"./host-context-KsSKxKbI.js";import{t as i}from"./button-BV_AiLj2.js";import{wn as a}from"./index-BAXboPqe.js";import{n as o}from"./save-cue-CpHgT93o.js";var s=e(t(),1),c=n(),l={dirty:0,invalid:0,busy:0},u=class{entries=new Map;listeners=new Set;snapshot=l;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;set(e,t,n){this.entries.set(e,{...t,draft:n}),this.publish()}delete(e){this.entries.delete(e)&&this.publish()}dirtyDrafts(){return[...this.entries.values()].filter(e=>e.dirty).map(e=>e.draft.current)}publish(){let e=0,t=0,n=0;for(let r of this.entries.values())r.dirty&&(e+=1,r.invalid&&(t+=1),r.busy&&(n+=1));let{snapshot:r}=this;if(!(e===r.dirty&&t===r.invalid&&n===r.busy)){this.snapshot=e===0&&t===0&&n===0?l:{dirty:e,invalid:t,busy:n};for(let e of this.listeners)e()}}},d=(0,s.createContext)(null);function f(e){let t=(0,s.useContext)(d);if(!t)throw Error(`useSettingsDraft needs a SettingsDraftScope above it`);let n=(0,s.useId)(),r=(0,s.useRef)(e);(0,s.useLayoutEffect)(()=>{r.current=e});let i=e.dirty,o=e.invalid===!0,c=e.busy===!0;(0,s.useLayoutEffect)(()=>{t.set(n,{dirty:i,invalid:o,busy:c},r)},[t,n,i,o,c]),(0,s.useLayoutEffect)(()=>()=>t.delete(n),[t,n]),a(e.holdsReload??i)}function p({children:e}){let[t]=(0,s.useState)(()=>new u);return(0,c.jsxs)(d.Provider,{value:t,children:[e,(0,c.jsx)(h,{store:t})]})}function m(e){return e===1?`1 field`:`${e} fields`}function h({store:e}){let{dirty:t,invalid:n,busy:a}=(0,s.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(0),{saved:p,flash:h}=o(),g=(0,s.useRef)(!0);(0,s.useLayoutEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]);let _=async()=>{u(!0),f(0);let t=r(),n=0;for(let i of e.dirtyDrafts()){if(!g.current||r()!==t)return;try{await i.save()}catch{n+=1}}g.current&&(u(!1),n>0?f(n):h())},v=()=>{f(0);for(let t of e.dirtyDrafts())t.discard()},y=l||a>0;if(t===0&&!y)return p?(0,c.jsx)(`div`,{"data-slot":`settings-save-bar`,"data-state":`saved`,className:`settings-save-bar`,children:(0,c.jsx)(`span`,{role:`status`,className:`settings-save-bar-message`,children:`Saved`})}):null;let b=`Unsaved changes`;return y?b=`Saving…`:n>0?b=`Unsaved changes — fix ${m(n)}`:d>0&&(b=`Unsaved changes — ${m(d)} did not save`),(0,c.jsxs)(`div`,{"data-slot":`settings-save-bar`,"data-state":y?`saving`:`dirty`,className:`settings-save-bar`,children:[(0,c.jsx)(`span`,{role:`status`,className:`settings-save-bar-message`,children:b}),(0,c.jsxs)(`span`,{className:`settings-save-bar-actions`,children:[(0,c.jsx)(i,{type:`button`,variant:`outline`,size:`sm`,"data-action":`settings-discard`,disabled:y,onClick:v,children:`Discard`}),(0,c.jsx)(i,{type:`button`,variant:`primary`,size:`sm`,"data-action":`settings-save`,disabled:y||n>0,onClick:()=>void _(),children:`Save`})]})]})}function g(){return(0,c.jsx)(`button`,{type:`submit`,hidden:!0,tabIndex:-1,"aria-hidden":`true`,"data-slot":`settings-implicit-submit`})}export{p as n,f as r,g as t};
|