@uniqbit/mate-core 1.0.0-canary.7 → 1.0.0-canary.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/package.json +6 -3
- package/src/cli/commands/artifact/delivery/submit.ts +6 -4
- package/src/cli/commands/artifact/finish/command.ts +28 -11
- package/src/cli/commands/artifact/pending/command.ts +71 -7
- package/src/cli/commands/cap/tokensave.ts +2 -2
- package/src/cli/commands/companion/update.ts +2 -3
- package/src/cli/commands/doctor.ts +16 -4
- package/src/cli/commands/install.ts +8 -4
- package/src/cli/commands/plugin/install.ts +82 -35
- package/src/cli/commands/studio/service-host.ts +3 -0
- package/src/cli/commands/triage.ts +32 -11
- package/src/cli/commands/vscode/release-vsix.json +2 -2
- package/src/cli/install-plan.tsx +3 -0
- package/src/cli/main.ts +51 -7
- package/src/cli/usage.ts +3 -3
- package/src/factory-host.ts +6 -0
- package/src/index.ts +1 -0
- package/src/lib/delivery/merge-git.ts +31 -7
- package/src/lib/delivery/overlap.ts +14 -1
- package/src/lib/delivery/repository-access.ts +11 -6
- package/src/lib/delivery/staging/apply-chain.ts +25 -7
- package/src/lib/delivery/staging/linked-merges.ts +175 -0
- package/src/lib/delivery/staging/naming.ts +3 -0
- package/src/lib/delivery/staging/openspec-type.ts +38 -7
- package/src/lib/delivery/staging/pending.ts +153 -11
- package/src/lib/delivery/staging/preflight.ts +239 -0
- package/src/lib/delivery/staging/project.ts +243 -104
- package/src/lib/delivery/staging/replay.ts +5 -3
- package/src/lib/delivery/staging/settle-linked.ts +5 -119
- package/src/lib/delivery/staging/submit.ts +139 -18
- package/src/lib/delivery/submit-change.ts +163 -37
- package/src/lib/friction/mark.ts +49 -11
- package/src/lib/friction/view/read.ts +10 -1
- package/src/lib/openspec-cli.ts +10 -5
- package/src/lib/skills-cli.ts +38 -0
- package/src/lib/tool-manifest.ts +73 -0
- package/src/lib/triage/context.ts +138 -12
- package/src/lib/triage/prepare.ts +19 -4
- package/src/plugin-api.ts +1 -0
- package/src/runtime/command-arg.ts +15 -0
- package/src/runtime/companion-guidance.ts +1 -1
- package/src/runtime/friction-log.ts +41 -17
- package/src/runtime/friction-recorder.ts +15 -2
- package/src/runtime/git-tracked.ts +13 -2
- package/src/studio.ts +6 -1
- package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +5 -1
- package/src/templates/capabilities/react-doctor/mate-react-doctor/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +42 -4
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +27 -2
- package/src/templates/mate-skills/agents/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +26 -1
- package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +28 -3
- package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-grilling/SKILL.md +25 -0
- package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +28 -3
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +28 -6
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +27 -2
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +24 -2
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +42 -4
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +27 -2
- package/src/templates/mate-skills/claude/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +26 -1
- package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +28 -3
- package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-grilling/SKILL.md +25 -0
- package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +28 -3
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +28 -6
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +27 -2
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +24 -2
- package/src/templates/triage/PLAYBOOK.md +9 -1
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +108 -108
- package/src/tools/setup/capabilities/graphify.ts +23 -1
- package/src/tools/setup/capabilities/rtk.ts +27 -86
- package/src/tools/setup/capabilities/tokensave.ts +76 -54
- package/src/tools/setup/dynamic-plugins/audiences.ts +28 -14
- package/src/tools/setup/dynamic-plugins/hydrate.ts +32 -14
- package/src/tools/setup/dynamic-plugins/install.ts +2 -0
- package/src/tools/setup/dynamic-plugins/installed.ts +73 -0
- package/src/tools/setup/dynamic-plugins/loader.ts +12 -10
- package/src/tools/setup/dynamic-plugins/local.ts +492 -0
- package/src/tools/setup/dynamic-plugins/paths.ts +34 -6
- package/src/tools/setup/dynamic-plugins/verify.ts +34 -14
- package/src/tools/setup/dynamic-plugins/workspaces.ts +17 -8
- package/src/tools/setup/mate.ts +26 -1
- package/src/tools/setup/plugins/gitignore.ts +45 -12
- package/src/tools/setup/service.ts +8 -0
- package/src/tools/setup/utils.ts +10 -1
- package/studio-dist/client/assets/app-ggXJ_QVh.css +2 -0
- package/studio-dist/client/assets/button-amJ3g5oD.js +1 -0
- package/studio-dist/client/assets/cn-BQPKiwI4.js +1 -0
- package/studio-dist/client/assets/combobox-CJ7aGFid.js +1 -0
- package/studio-dist/client/assets/{companion-view-DINdPF-b.js → companion-view-C_N237bf.js} +1 -1
- package/studio-dist/client/assets/fields-BAiGkJ5N.js +1 -0
- package/studio-dist/client/assets/friction-DqOU59v7.js +1 -0
- package/studio-dist/client/assets/getting-started-yp42dj5S.js +1 -0
- package/studio-dist/client/assets/{getting-started._topic-DVB8e5R9.js → getting-started._topic-C9zVXz_m.js} +1 -1
- package/studio-dist/client/assets/{getting-started.index-DQvLHEr1.js → getting-started.index-DWbDKICP.js} +1 -1
- package/studio-dist/client/assets/graph-BYaD_5Bq.js +2 -0
- package/studio-dist/client/assets/{graph-canvas-DIcAqwtK.js → graph-canvas-ySGKMhmk.js} +1 -1
- package/studio-dist/client/assets/index-Qx7reRPD.js +40 -0
- package/studio-dist/client/assets/panel-C4bf_h2W.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-y6f2FDAB.js +1 -0
- package/studio-dist/client/assets/reports-JFSwSueq.js +1 -0
- package/studio-dist/client/assets/routes-BdOWSgzK.js +1 -0
- package/studio-dist/client/assets/select-BHYYWPhK.js +1 -0
- package/studio-dist/client/assets/skills-Bo9FLsBd.js +1 -0
- package/studio-dist/client/assets/{specs-Dl8HfGlU.js → specs-BrCOjOch.js} +1 -1
- package/studio-dist/client/assets/specs-view-CdE2rlli.js +1 -0
- package/studio-dist/client/assets/{store-DyXbi6o9.js → store-C3vJq8Wj.js} +1 -1
- package/studio-dist/client/assets/{usage-Blcl8kA_.js → usage-BLsLy0nN.js} +13 -13
- package/studio-dist/client/assets/{useAnchoredPopupScrollLock-BBXJpX5L.js → useAnchoredPopupScrollLock-DC7f8GOp.js} +1 -1
- package/studio-dist/client/assets/useMutation-uJUrejsi.js +1 -0
- package/studio-dist/client/assets/vault-BB1B_OhR.js +1 -0
- package/studio-dist/client/assets/warnings-CqOOGlPD.js +1 -0
- package/studio-dist/client/assets/workflow-BFzmI-06.js +1 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-JoHQ5ihx.js → __23tanstack-start-server-fn-resolver-gVfW5vIV.js} +1 -1
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +42 -42
- package/studio-dist/server/assets/{button-B7e1fRyW.js → button-D6bvrFmm.js} +3 -3480
- package/studio-dist/server/assets/cn-FXJAM0KO.js +5528 -0
- package/studio-dist/server/assets/{combobox--S_OmUfh.js → combobox-D2MbYV1O.js} +6 -5
- package/studio-dist/server/assets/{companion-view-D-vGM55e.js → companion-view-Mf1ANbMb.js} +2 -2
- package/studio-dist/server/assets/{fields-B4qM2ZwC.js → fields-B4mAPETz.js} +2 -1
- package/studio-dist/server/assets/{friction-sLxaWY-H.js → friction-9a5S1m7U.js} +54 -14
- package/studio-dist/server/assets/{getting-started-Cq5Pcnsr.js → getting-started-RU6tYU2Q.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-CmWdl3u3.js → getting-started._topic-C02HGrC6.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-AB8xpTFY.js → getting-started.index-EzLRosbb.js} +2 -2
- package/studio-dist/server/assets/{graph-C_Hn-Wf_.js → graph-CZ2H9Fzr.js} +7 -6
- package/studio-dist/server/assets/{graph-canvas-BthrSmPS.js → graph-canvas-rP5TT14Z.js} +1 -1
- package/studio-dist/server/assets/{guides-BVQ4pt5B.js → guides-BGftp4wf.js} +1 -1
- package/studio-dist/server/assets/{markdown-view-rwiiVcPC.js → markdown-view-CArpV-CS.js} +1 -1
- package/studio-dist/server/assets/{panel-CUxRIpYL.js → panel-DR0iq46J.js} +4 -3
- package/studio-dist/server/assets/{plugins._service._view-BSvGnlhU.js → plugins._service._view-n7u2k5dF.js} +7 -4
- package/studio-dist/server/assets/{queries-S_Pl90IG.js → queries-D-yVP9i0.js} +1 -1
- package/studio-dist/server/assets/{reports-CJpAItPk.js → reports-C2SmTgqh.js} +6 -5
- package/studio-dist/server/assets/{router-DF0etoNa.js → router-CPt0TAk_.js} +54 -29
- package/studio-dist/server/assets/{routes-6ylCLkyg.js → routes-CwH8LEy2.js} +8 -7
- package/studio-dist/server/assets/{select-CjuKScan.js → select-C3i6TTX-.js} +5 -4
- package/studio-dist/server/assets/{shell-DLkP7wG9.js → shell-CagqZZMZ.js} +2 -1
- package/studio-dist/server/assets/{skills-zeU80A9S.js → skills-C21Mg_8-.js} +7 -6
- package/studio-dist/server/assets/{specs-DDBNT_v1.js → specs-DetoMiaB.js} +3 -3
- package/studio-dist/server/assets/{specs-view-exvmWdg0.js → specs-view-CmbfLDwN.js} +9 -8
- package/studio-dist/server/assets/{store-kS7zk0Hr.js → store-aC-I6f6o.js} +1 -1
- package/studio-dist/server/assets/{studio-queries-qOXOYoPt.js → studio-queries-Dqf-3nzj.js} +1 -1
- package/studio-dist/server/assets/{usage-C2um7YiV.js → usage-CS4CBK9D.js} +9 -9
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-kQBB3y_b.js → useAnchoredPopupScrollLock-BjMNgXv9.js} +2 -2
- package/studio-dist/server/assets/{useMutation-C-WO6hCM.js → useMutation-DpBIuWXt.js} +2 -2
- package/studio-dist/server/assets/{vault-B8vgVIH9.js → vault-DVQidlId.js} +6 -6
- package/studio-dist/server/assets/{warnings-BxK4VfV5.js → warnings-C7hgXpdk.js} +2 -1
- package/studio-dist/server/assets/{workflow-BrTK632u.js → workflow-6dZZ1ofw.js} +7 -6
- package/studio-dist/server/server.js +2 -2
- package/tool-manifest.yaml +85 -0
- package/studio-dist/client/assets/app-aIwDxf48.css +0 -2
- package/studio-dist/client/assets/button-CX0sWAJl.js +0 -1
- package/studio-dist/client/assets/combobox-BmA8RjOc.js +0 -1
- package/studio-dist/client/assets/fields-BobQ7zRF.js +0 -1
- package/studio-dist/client/assets/friction-YdYd3zaz.js +0 -1
- package/studio-dist/client/assets/getting-started-CY7NEtTw.js +0 -1
- package/studio-dist/client/assets/graph-DbNnR884.js +0 -2
- package/studio-dist/client/assets/index-CysBCSxM.js +0 -40
- package/studio-dist/client/assets/panel-Csr49lBo.js +0 -1
- package/studio-dist/client/assets/plugins._service._view-CEA_CcPe.js +0 -1
- package/studio-dist/client/assets/reports-CLdgxxkg.js +0 -1
- package/studio-dist/client/assets/routes-DGilWbDE.js +0 -1
- package/studio-dist/client/assets/select-DdebbX7K.js +0 -1
- package/studio-dist/client/assets/skills-C3zNkU8g.js +0 -1
- package/studio-dist/client/assets/specs-view-B_n0Pekv.js +0 -1
- package/studio-dist/client/assets/useBaseQuery-C2cjmeH2.js +0 -1
- package/studio-dist/client/assets/useMutation-DI6LbvVa.js +0 -1
- package/studio-dist/client/assets/vault-Cb9DmM1i.js +0 -1
- package/studio-dist/client/assets/warnings-B-rvoW8q.js +0 -1
- package/studio-dist/client/assets/workflow-DN5T19jd.js +0 -1
- package/studio-dist/server/assets/useBaseQuery--iH3rd-T.js +0 -2051
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{Lr as r,r as i,t as a}from"./button-CX0sWAJl.js";import{F as o,I as s,L as c,M as l,N as u,P as d,j as f}from"./index-CysBCSxM.js";import{n as p}from"./fields-BobQ7zRF.js";var m=e(t(),1),h=n();function g(e){return(0,h.jsx)(u,{"data-slot":`sheet`,...e})}var _=s;function v({className:e,wide:t=!1,...n}){return(0,h.jsxs)(d,{children:[(0,h.jsx)(c,{"data-slot":`sheet-overlay`,className:`fixed inset-0 z-30 bg-[color-mix(in_srgb,var(--bg)_45%,transparent)] transition-opacity duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`}),(0,h.jsx)(o,{"data-slot":`sheet-content`,"data-wide":t?``:void 0,className:r(`fixed top-2 right-2 bottom-2 z-30 flex w-[min(560px,calc(100vw-16px))] flex-col overflow-hidden rounded-panel border border-rule bg-surface text-text shadow-float outline-none transition-[transform,width] duration-250 ease-[cubic-bezier(.16,1,.3,1)] data-ending-style:translate-x-[calc(100%+16px)] data-starting-style:translate-x-[calc(100%+16px)] data-wide:w-[min(760px,calc(100vw-16px))]`,e),...n})]})}function y({className:e,...t}){return(0,h.jsx)(l,{"data-slot":`sheet-title`,className:r(`m-0 text-lg font-semibold break-words`,e),...t})}function b({items:e,current:t,onSelect:n,pass:r,wide:o,title:s,children:c}){let l=(0,m.useRef)(null),u=t!==null,d=t===null?-1:e.indexOf(t),b=d>0?e[d-1]:void 0,x=d>=0&&d<e.length-1?e[d+1]:void 0;(0,m.useEffect)(()=>{let e=e=>{let t=e.target;t?.closest&&!t.closest(`[data-slot=sheet-content]`)&&(l.current=t)};return document.addEventListener(`focusin`,e),()=>document.removeEventListener(`focusin`,e)},[]);let S=(0,m.useEffectEvent)(e=>{if(e.metaKey||e.ctrlKey||e.altKey||f(e.target))return;let t=e.key===`ArrowRight`?x:e.key===`ArrowLeft`?b:void 0;t!==void 0&&(e.preventDefault(),n(t))});return(0,m.useEffect)(()=>{if(!u)return;let e=e=>S(e);return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[u]),(0,h.jsx)(g,{open:u,onOpenChange:e=>{e||n(null)},children:(0,h.jsxs)(v,{wide:o,"aria-label":s,finalFocus:()=>!l.current?.isConnected||l.current,initialFocus:()=>document.getElementById(`side-panel-close`),children:[(0,h.jsx)(y,{className:`sr-only`,children:s}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-rule py-2.5 pr-3 pl-5`,children:[(0,h.jsxs)(`span`,{className:`mr-auto font-mono text-xs text-muted`,"aria-live":`polite`,children:[d>=0?`${d+1} of ${e.length}`:null,r?` · ${r}`:null]}),(0,h.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Previous`,disabled:b===void 0,onClick:()=>b!==void 0&&n(b),children:(0,h.jsx)(i,{name:`left`})}),(0,h.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Next`,disabled:x===void 0,onClick:()=>x!==void 0&&n(x),children:(0,h.jsx)(i,{name:`right`})}),(0,h.jsx)(_,{id:`side-panel-close`,render:(0,h.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Close`}),children:(0,h.jsx)(i,{name:`close`})})]}),(0,h.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-auto`,children:c}),(0,h.jsxs)(`div`,{className:`flex gap-3.5 border-t border-rule px-5 py-2.5 text-2xs text-muted max-sm:hidden`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,h.jsx)(p,{children:`←`}),(0,h.jsx)(p,{children:`→`}),` previous, next`]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,h.jsx)(p,{children:`esc`}),` close`]})]})]})})}function x({kicker:e,title:t,mono:n=!1,children:r}){return(0,h.jsxs)(`div`,{className:`grid gap-1.5 border-b border-rule px-5 pt-4 pb-3.5`,children:[e?(0,h.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:e}):null,(0,h.jsx)(`h2`,{className:n?`m-0 font-mono text-md font-semibold break-words`:`m-0 text-lg font-semibold`,children:t}),r]})}function S({title:e,aside:t,children:n}){return(0,h.jsxs)(`section`,{className:`grid gap-2.5 border-b border-rule-soft px-5 py-4`,"aria-label":e,children:[(0,h.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[e,t?(0,h.jsx)(`span`,{className:`ml-auto font-mono text-2xs font-normal text-muted`,children:t}):null]}),n]})}export{S as n,b as r,x as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{lt as e,rt as t,t as n}from"./index-CysBCSxM.js";import"./studio-0ueISxwP.js";import{S as r,u as i}from"./studio-queries-BflKt9va.js";import{a,n as o,t as s}from"./jsx-runtime-MZURdZre.js";var c=a(o(),1),l=s(),u=e=>import(e);async function d(e,t,n,r=u){let i=(await r(t)).mount;if(typeof i!=`function`)throw Error(`the view module has no mount export`);let a=i(e,n);return typeof a==`function`?a:()=>{}}function f({moduleUrl:e,context:n,load:r}){let i=(0,c.useRef)(null),[a,o]=(0,c.useState)(null),{companion:s,apiBase:u,writable:f}=n;return(0,c.useEffect)(()=>{let n=i.current;if(!n)return;let a=null,c=!1;o(null);let l=t()??void 0;return d(n,e,{companion:s,apiBase:u,writable:f,connection:l},r).then(e=>{c?e():a=e},e=>{c||o(e instanceof Error?e.message:String(e))}),()=>{c=!0,a?.(),n.replaceChildren()}},[e,s,u,f,r]),(0,l.jsxs)(`section`,{className:`plugin-view mx-8 min-h-0 flex-1 max-sm:mx-4`,children:[a?(0,l.jsxs)(`p`,{className:`m-0 rounded-card border border-dashed border-rule px-6 py-7 text-muted`,children:[`The view could not load: `,a]}):null,(0,l.jsx)(`div`,{ref:i,"data-plugin-view":e})]})}var p=function(){let{service:t,view:a}=n.useParams(),o=n.useSearch(),{data:s}=e(i(o)),c=s.pluginViews.find(e=>e.service===t&&e.view===a);return c?(0,l.jsx)(f,{moduleUrl:c.moduleUrl,context:{companion:s.selected?.digest??null,apiBase:`${r}${t}`,writable:s.writable}}):(0,l.jsx)(`section`,{className:`mx-8 max-sm:mx-4`,children:(0,l.jsx)(`p`,{className:`empty m-0 rounded-card border border-dashed border-rule px-6 py-7 text-muted`,children:`No running service offers this view.`})})};export{p as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Lr as e,ct as t,it as n,nt as r,r as i,rt as a,zr as o}from"./button-CX0sWAJl.js";import{a as s,t as c}from"./useSelector-AYcH7lB0.js";import{l,st as u,x as d}from"./studio-queries-BflKt9va.js";import{a as f,n as p,t as m}from"./jsx-runtime-MZURdZre.js";import{r as h,t as g}from"./panel-Csr49lBo.js";import{et as _,l as v,nt as y}from"./index-CysBCSxM.js";import"./studio-0ueISxwP.js";function b(e){let t=s();return c(t.stores.location,u(e,t))}var x=f(p(),1),S=e=>String(e).padStart(2,`0`);function C(e){let t=new Date(e);return`${t.getFullYear()}-${S(t.getMonth()+1)}-${S(t.getDate())} ${S(t.getHours())}:${S(t.getMinutes())}`}function w(e,t){let n=t===`system`?``:`?scheme=${t}`;return`${d}${e}${n}`}var T=m(),E=/(?:^|[#&])report=([0-9a-f]{32})/;function D(e){try{let t=`${location.pathname}${location.search}${e?`#report=${e}`:``}`;history.replaceState(history.state,``,t)}catch{}}function O({report:e,src:t}){return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(g,{title:e.title,kicker:(0,T.jsx)(`span`,{children:C(e.createdAt)}),children:(0,T.jsxs)(`a`,{id:`reports-open`,className:`inline-flex items-center gap-1.5 text-sm`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,T.jsx)(i,{name:`external`,className:`size-3.5`}),` Open in new tab`]})}),(0,T.jsx)(`iframe`,{id:`reports-frame`,className:`min-h-0 w-full flex-1 border-0 bg-page`,title:`Hosted report`,sandbox:`allow-scripts allow-modals`,referrerPolicy:`no-referrer`,src:t},t)]})}function k({companion:i}){let s=o(l(i)),c=_(e=>e.theme),u=y(e=>e.clearReports),d=E.exec(b({select:e=>`#${e.hash}`}))?.[1],[f,p]=(0,x.useState)(void 0);(0,x.useEffect)(u,[u]);let m=s.data??[],g=f===void 0?d??null:f,v=m.find(e=>e.id===g)??null,S=e=>{p(e),D(e)},k=v?w(v.id,c):null;return(0,T.jsxs)(`section`,{className:e(n,`grid content-start gap-3 pb-10`),"data-reports-view":!0,"aria-label":`Hosted reports`,children:[m.length===0?(0,T.jsx)(r,{children:(0,T.jsx)(`span`,{id:`reports-empty`,children:`No hosted reports yet.`})}):(0,T.jsx)(a,{title:`Reports`,count:m.length,hint:`Newest first`,children:(0,T.jsx)(`ul`,{id:`reports-list`,className:`m-0 list-none p-0`,"aria-label":`Reports`,children:m.map(n=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,className:e(t,`grid grid-cols-[minmax(0,1fr)_auto]`),"data-report-id":n.id,"aria-current":n.id===v?.id?`true`:void 0,onClick:()=>S(n.id),children:[(0,T.jsx)(`span`,{className:`truncate text-sm`,"data-report-title":!0,children:n.title}),(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted`,"data-report-time":!0,children:C(n.createdAt)})]})},n.id))})}),(0,T.jsx)(h,{items:m.map(e=>e.id),current:v?.id??null,onSelect:S,wide:!0,title:v?`Report ${v.title}`:`Report`,children:v&&k?(0,T.jsx)(O,{report:v,src:k}):null})]})}var A=function(){let{companion:e}=v.useSearch();return e?(0,T.jsx)(k,{companion:e}):null};export{A as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./companion-view-DINdPF-b.js";import{at as t,f as n,it as r,m as i}from"./studio-queries-BflKt9va.js";import{a,n as o,t as s}from"./jsx-runtime-MZURdZre.js";import{$ as c,Lr as l,ct as u,et as d,it as f,lt as p,nt as m,ot as h,r as g,rt as _,st as v,t as y,tt as b,zr as x}from"./button-CX0sWAJl.js";import{n as S,r as C,t as w}from"./panel-Csr49lBo.js";import{t as T}from"./warnings-B-rvoW8q.js";import{t as E}from"./markdown-view-jMiaBTSO.js";import{A as ee,C as D,D as O,E as k,O as A,T as te,f as ne,k as j,w as M}from"./index-CysBCSxM.js";var N=a(o(),1);function re(e){let t=new Set,n=[];for(let r of e)for(let e of r.specs)t.has(e)||(t.add(e),n.push({capability:e,change:r.name,archivedOn:r.archivedOn}));return n}var P=s(),ie=20,ae=12,F=`openspec/changes/archive`,I=e=>`openspec/specs/${e}/spec.md`,L=l(u,`grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 py-2`);function R({payload:e}){let[t,n]=(0,N.useState)(null),r=e.shipped.slice(0,ie),i=r.find(e=>e.anchor===t)??null;return(0,P.jsxs)(`div`,{className:`analyst-overview`,children:[(0,P.jsx)(T,{warnings:e.warnings}),(0,P.jsx)(`div`,{className:l(f,`@container pb-10`),children:(0,P.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)] items-start gap-3 @max-[760px]:grid-cols-1`,children:[(0,P.jsx)(V,{all:e.shipped.length,shown:r,current:t,onOpen:n}),(0,P.jsx)(U,{shipped:e.shipped})]})}),(0,P.jsx)(C,{items:r.map(e=>e.anchor),current:i?.anchor??null,onSelect:n,title:i?`Shipped change ${i.name}`:`Shipped change`,children:i?(0,P.jsx)(H,{change:i}):null})]})}function z(e){let t=[];for(let n of e){let e=t.at(-1);e?.[0]===n.archivedOn?e[1].push(n):t.push([n.archivedOn,[n]])}return t}function B(e){let t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(`en`,{weekday:`long`,timeZone:`UTC`})}function V({all:e,shown:t,current:n,onOpen:r}){return(0,P.jsx)(_,{title:`Recently shipped`,count:e,hint:e>t.length?`newest ${t.length}`:void 0,children:t.length===0?(0,P.jsx)(`p`,{className:`empty m-0 px-4 py-3 text-sm text-muted`,children:`No shipped changes yet.`}):(0,P.jsx)(`ol`,{className:`analyst-days m-0 list-none p-0`,children:z(t).map(([e,t])=>(0,P.jsxs)(`li`,{className:`border-t border-rule first:border-t-0`,children:[(0,P.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 bg-[color-mix(in_srgb,var(--surface)_45%,transparent)] px-4 pt-2.5 pb-1.5 text-xs font-semibold text-muted`,children:[(0,P.jsx)(`time`,{dateTime:e,className:`font-mono text-text`,children:e}),B(e),(0,P.jsx)(b,{value:t.length})]}),(0,P.jsx)(`ol`,{className:`analyst-list m-0 list-none p-0`,children:t.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,className:l(u,`grid gap-0.5 py-2`),"aria-current":n===e.anchor?`true`:void 0,onClick:()=>r(e.anchor),children:[(0,P.jsx)(`span`,{className:`analyst-row-title truncate font-mono text-sm`,children:e.name}),(0,P.jsx)(`span`,{className:`truncate text-xs text-muted`,children:e.specs.length===0?`no spec changes`:e.specs.join(`, `)})]})},e.anchor))})]},e))})})}function H({change:e}){let t=`${F}/${e.anchor}`;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{mono:!0,title:e.name,kicker:(0,P.jsxs)(`span`,{children:[`Shipped `,e.archivedOn]})}),(0,P.jsx)(S,{title:`Proposal`,children:e.hasProposal?(0,P.jsxs)(r,{className:`inline-flex items-center gap-2 text-sm`,to:`/vault`,search:e=>({...e,path:`${t}/proposal.md`}),children:[(0,P.jsx)(g,{name:`doc`}),` Read the proposal`]}):(0,P.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`This change has no proposal.`,` `,(0,P.jsx)(r,{to:`/vault`,search:e=>({...e,dir:t}),children:`Open its folder`})]})}),(0,P.jsx)(S,{title:`Specs it changed`,aside:String(e.specs.length),children:e.specs.length===0?(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No spec changed.`}):(0,P.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:e.specs.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(r,{className:`font-mono text-sm`,to:`/vault`,search:t=>({...t,path:I(e)}),children:e})},e))})})]})}function U({shipped:e}){let t=re(e).slice(0,ae);return(0,P.jsx)(_,{title:`Recently changed specs`,hint:(0,P.jsx)(r,{to:`/specs`,search:e=>e,children:`All specs`}),children:t.length===0?(0,P.jsx)(`p`,{className:`empty m-0 px-4 py-3 text-sm text-muted`,children:`No specs changed by shipped changes yet.`}):(0,P.jsx)(`ol`,{className:`analyst-list m-0 list-none p-0`,children:t.map((e,n)=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(r,{className:L,to:`/vault`,search:t=>({...t,path:I(e.capability)}),children:[(0,P.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,P.jsx)(`span`,{className:`analyst-row-title truncate font-mono text-sm`,children:e.capability}),(0,P.jsxs)(`span`,{className:`truncate text-xs text-muted`,children:[`by `,e.change]})]}),(0,P.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:e.archivedOn===t[n-1]?.archivedOn?null:e.archivedOn})]})},e.capability))})})}var W={accent:`before:bg-accent`,warn:`before:bg-warn`,why:`before:bg-why`,bad:`before:bg-bad`},G={accent:`bg-accent`,warn:`bg-warn`,why:`bg-why`,bad:`bg-bad`},K={accent:`text-text`,warn:`text-warn`,why:`text-why`,bad:`text-bad`};function q({steps:e,current:t,tone:n}){let r=`Step ${t+1} of ${e.length} · ${e[t]}`;return t<0?r=`Saved for later`:t>=e.length&&(r=`Delivered`),(0,P.jsxs)(`div`,{className:`grid gap-2`,role:`group`,"aria-label":`Delivery Path`,children:[(0,P.jsx)(`p`,{className:l(`m-0 text-xs font-semibold`,t>=0?K[n]:`text-muted`),children:r}),(0,P.jsx)(`ol`,{className:`m-0 grid list-none gap-1 p-0`,style:{gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`},children:e.map((e,r)=>(0,P.jsx)(`li`,{"aria-current":r===t?`step`:void 0,className:l(`h-1 rounded-full bg-rule`,r<t&&`bg-[color-mix(in_srgb,var(--accent)_55%,var(--border))]`,r===t&&G[n]),children:(0,P.jsx)(`span`,{className:`sr-only`,children:e})},e))})]})}function J({steps:e,current:t,tone:n=`accent`,compact:r=!1}){return r?(0,P.jsx)(q,{steps:e,current:t,tone:n}):(0,P.jsx)(`ol`,{className:`m-0 grid list-none gap-1 p-0`,style:{gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`},"aria-label":`Delivery Path`,children:e.map((e,r)=>(0,P.jsx)(`li`,{"aria-current":r===t?`step`:void 0,className:l(`grid gap-1.5 text-2xs text-muted before:h-1 before:rounded-full before:bg-rule before:content-['']`,r<t&&`before:bg-[color-mix(in_srgb,var(--accent)_55%,var(--border))]`,r===t&&`font-semibold text-text`,r===t&&W[n]),children:e},e))})}var oe=`openspec/changes`,Y=e=>`${oe}/${e.name}`,X=`flex w-full min-w-0 items-center gap-2.5 rounded-control border-0 bg-transparent px-2 py-1 text-left text-sm text-text hover:bg-surface-soft disabled:cursor-default disabled:hover:bg-transparent`;function se({done:e}){return(0,P.jsx)(`span`,{className:l(`grid size-3.5 flex-none place-items-center rounded-[4px] border`,e?`border-accent bg-accent text-on-accent`:`border-rule bg-page`),"aria-hidden":`true`,children:e?(0,P.jsx)(g,{name:`check`,className:`size-2.5 [stroke-width:2.4]`}):null})}function ce({companion:e,dir:t,onRead:i}){let a=x(n(e,`${t}/specs`));if(a.isPending)return(0,P.jsx)(`p`,{className:`m-0 pl-8 text-xs text-muted`,children:`Listing specs…`});let o=(a.data?.entries??[]).filter(e=>e.kind===`directory`);return a.isError||o.length===0?(0,P.jsx)(`p`,{className:`m-0 pl-8 text-xs text-muted`,children:(0,P.jsx)(r,{to:`/vault`,search:e=>({...e,dir:`${t}/specs`}),children:`Open the specs folder`})}):(0,P.jsx)(`ul`,{className:`m-0 grid list-none gap-0.5 p-0 pl-6`,children:o.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,className:X,"data-artifact-file":`${e.path}/spec.md`,onClick:()=>i(`${e.path}/spec.md`),children:[(0,P.jsx)(g,{name:`doc`,className:`flex-none text-muted`}),(0,P.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.name})]})},e.path))})}function le(e){return e.declared?e.folder?`folder`:`read`:e.done?e.folder?`per capability`:`read`:`not yet`}function ue({change:e,companion:t,onRead:n}){if(e.artifacts.length===0)return(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No artifacts yet.`});let r=Y(e);return(0,P.jsx)(`ul`,{className:`m-0 -mx-2 grid list-none gap-0.5 p-0`,children:e.artifacts.map(e=>{let i=e.path!==void 0,a=e.status===`done`,o=(a||i)&&t!==void 0,s=e.path===void 0?e.id===`specs`:e.path.endsWith(`/`);return(0,P.jsxs)(`li`,{children:[(0,P.jsxs)(`button`,{type:`button`,className:X,disabled:!o||s,"data-artifact":e.id,onClick:()=>n(e.path??`${r}/${e.id}.md`),children:[i?null:(0,P.jsx)(se,{done:a}),(0,P.jsx)(`span`,{className:a||i?`text-text`:`text-muted`,children:e.id}),(0,P.jsx)(`span`,{className:`ml-auto text-xs text-muted`,children:le({declared:i,done:a,folder:s})}),o&&!s?(0,P.jsx)(g,{name:`right`,className:`text-muted`}):null]}),o&&s&&!i?(0,P.jsx)(ce,{companion:t,dir:r,onRead:n}):null]},e.id)})})}function de({companion:e,path:t}){let n=x(i(e,{path:t})),r=n.data?.open?.markdown;return r?(0,P.jsx)(`div`,{className:`prose-panel`,children:(0,P.jsx)(E,{nodes:r})}):(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:n.isPending?`Loading…`:`The file could not be read.`})}function fe({companion:e,path:t,change:n,onBack:i}){let a=t.slice(Y(n).length+1);return(0,P.jsxs)(`section`,{className:`grid content-start gap-3 px-5 py-4`,"aria-label":`Artifact ${a}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsxs)(y,{size:`sm`,variant:`ghost`,className:`-ml-2`,onClick:i,children:[(0,P.jsx)(g,{name:`left`}),` Artifacts`]}),(0,P.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted`,children:a}),(0,P.jsxs)(r,{className:`ml-auto inline-flex flex-none items-center gap-1.5 text-xs`,to:`/vault`,search:e=>({...e,path:t}),children:[(0,P.jsx)(g,{name:`external`,className:`size-3.5`}),` Open in Vault`]})]}),(0,P.jsx)(de,{companion:e,path:t})]})}var Z=`Awaiting publication`,pe=[],me={"needs-you":`Review or fix before the build goes on`,building:`Some tasks are done; others remain`,ready:`Every task is done`};function Q(e){if(e.valid===!1)return{marker:`issue`,word:`Invalid`};let t=k(e);if(e.planned===!1){let n=e.position?.stage;return n?t===`ready`?{marker:`done`,word:n.label}:{marker:n.kind===`review`?`review`:`build`,word:n.label}:{marker:`idle`,word:e.dropped?`Dropped`:`Not placed`}}return t===`needs-you`?(e.totalTasks??0)===0?{marker:`warn`,word:`No tasks`}:{marker:`review`,word:`Review`}:t===`building`?{marker:`build`,word:M.building}:{marker:`done`,word:`Ready`}}function he({change:e,workflow:t,companion:n,reading:r,onRead:i}){let a=j(e,t),o=O(t),s=A(e),{marker:l,word:u}=Q(e),f=(0,P.jsx)(S,{title:`Artifacts`,aside:e.schemaName,children:(0,P.jsx)(ue,{change:e,companion:n,onRead:i})}),m=k(e)===`needs-you`;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{mono:!0,title:e.name,kicker:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p,{marker:l,children:u}),(0,P.jsx)(c,{at:e.lastModified,className:`ml-auto`})]}),children:(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:a.situation})}),r&&n?(0,P.jsx)(fe,{companion:n,path:r,change:e,onBack:()=>i(null)}):(0,P.jsxs)(P.Fragment,{children:[m?f:null,(0,P.jsx)(S,{title:`Delivery Path`,aside:a.stage,children:(0,P.jsx)(J,{steps:o.map(e=>e.label),current:o.findIndex(e=>e.id===a.stageId),tone:a.review?`why`:`accent`})}),(0,P.jsxs)(S,{title:`Next step`,children:[(0,P.jsxs)(`p`,{className:`m-0 text-sm`,children:[a.next,`.`]}),(0,P.jsx)(d,{text:a.prompt})]}),e.planned===!1?null:(0,P.jsx)(S,{title:s.unit===`tasks`?`Tasks`:`Plan`,aside:`${s.done}/${s.total}`,children:(0,P.jsx)(v,{...s})}),m?null:f]})]})}function ge({change:e,workflow:t,current:n,onOpen:r}){let{marker:i,word:a}=Q(e),o=j(e,t);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,className:l(u,`grid grid-cols-[minmax(0,1fr)_max-content_150px_72px] @max-[640px]:grid-cols-[minmax(0,1fr)_auto]`),"aria-current":n?`true`:void 0,"data-change":e.name,onClick:r,children:[(0,P.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,P.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e.name}),(0,P.jsx)(`span`,{className:l(`truncate text-xs`,e.valid===!1?`text-bad`:`text-muted`),children:o.situation})]}),(0,P.jsx)(p,{marker:i,children:a}),(0,P.jsx)(`span`,{className:`@max-[640px]:hidden`,children:e.planned===!1?null:(0,P.jsx)(v,{...A(e)})}),(0,P.jsx)(c,{at:e.lastModified,className:`text-right @max-[640px]:hidden`})]})})}function $({change:e}){return(0,P.jsxs)(`li`,{className:l(u,`grid grid-cols-[minmax(0,1fr)_max-content] hover:bg-transparent`),"data-submitted":e.name,children:[(0,P.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,P.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e.name}),(0,P.jsxs)(`span`,{className:`truncate text-xs text-muted`,children:[(0,P.jsx)(`span`,{className:e.mine?`font-semibold text-accent`:void 0,children:e.mine?`Yours`:e.author??`Someone else`}),` · ${e.group||`no delivery branch`}`]})]}),e.blocked?(0,P.jsx)(p,{marker:`issue`,children:`Blocked`}):(0,P.jsx)(p,{marker:`idle`,children:`Submitted`})]})}function _e({submitted:e}){return e.length===0?null:(0,P.jsx)(_,{title:Z,count:e.length,hint:`Publish with /mate-publish-artifact once merged`,children:(0,P.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.map(e=>(0,P.jsx)($,{change:e},e.name))})})}function ve(e,t){return[{value:`all`,label:`All`,count:D.reduce((t,n)=>t+e[n].length,0)+t},...D.map(t=>({value:t,label:M[t],count:e[t].length,tone:t===`needs-you`?`warn`:void 0})),...t>0?[{value:`submitted`,label:Z,count:t}]:[]]}function ye({changes:e,submitted:n=pe,selected:r,companion:i,workflow:a}){let o=t(),[s,c]=(0,N.useState)(`all`),[u,d]=(0,N.useState)(!1),[p,g]=(0,N.useState)(null),v=te(e,n),x=ee(v),S=D.filter(e=>s===`all`||s===e),w=S.flatMap(e=>x[e]),T=u?x[`needs-you`]:w,E=v.find(e=>e.name===r)??null,O=p&&p.change===E?.name?p.path:null,k=e=>{e===null&&d(!1),o({to:`.`,search:t=>({...t,change:e??void 0}),replace:!0})};return v.length===0&&n.length===0?(0,P.jsx)(`section`,{className:l(f,`pb-10`),"aria-label":`Changes`,children:(0,P.jsx)(m,{children:`No change is in flight in this companion.`})}):(0,P.jsxs)(`section`,{className:l(f,`@container grid content-start gap-3 pb-10`),"aria-label":`Changes`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(h,{label:`Show changes`,value:s,onChange:c,options:ve(x,n.length)}),x[`needs-you`].length>0?(0,P.jsxs)(y,{variant:`primary`,size:`sm`,className:`ml-auto`,onClick:()=>{d(!0),k(x[`needs-you`][0].name)},children:[`Start review pass`,(0,P.jsx)(b,{value:x[`needs-you`].length})]}):null]}),S.map(e=>x[e].length===0?null:(0,P.jsx)(_,{title:M[e],count:x[e].length,hint:me[e],tone:e===`needs-you`?`warn`:void 0,children:(0,P.jsx)(`ul`,{className:`m-0 list-none p-0`,children:x[e].map(e=>(0,P.jsx)(ge,{change:e,workflow:a,current:e.name===r,onOpen:()=>{d(!1),k(e.name)}},e.name))})},e)),s===`all`||s===`submitted`?(0,P.jsx)(_e,{submitted:n}):null,(0,P.jsx)(C,{items:T.map(e=>e.name),current:E?.name??null,onSelect:k,pass:u?`Needs you`:void 0,wide:O!==null,title:E?`Change ${E.name}`:`Change`,children:E?(0,P.jsx)(he,{change:E,workflow:a,companion:i,reading:O,onRead:e=>g(e?{change:E.name,path:e}:null)}):null})]})}function be({payload:e,selected:t,companion:n}){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(T,{warnings:e.warnings}),(0,P.jsx)(ye,{changes:e.changes,submitted:e.submitted,selected:t,companion:n,workflow:e.workflow??void 0})]})}function xe(){let t=ne.useSearch();return(0,P.jsx)(e,{view:`dashboard`,search:t,children:e=>e.studioMode===`analysis`?(0,P.jsx)(R,{payload:{shipped:e.shipped??[],warnings:e.warnings}}):(0,P.jsx)(be,{payload:{changes:e.changes??[],submitted:e.submitted,warnings:e.warnings,workflow:e.workflow},selected:t.change,companion:t.companion})})}export{xe as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{$n as r,Ar as i,Bn as a,Dn as o,Dr as s,Dt as c,Er as l,Fn as u,G as d,H as f,Ir as p,L as m,Lr as h,M as g,Mr as _,Nn as v,Nr as y,Or as b,Pn as x,Qt as S,S as C,T as w,Tn as T,V as E,W as D,Wn as O,Xt as k,Y as A,a as j,ar as M,cn as N,dn as P,er as F,f as I,gr as L,ht as R,ir as ee,kn as te,kr as z,kt as B,l as V,mt as ne,nr as re,or as H,pt as ie,q as ae,qn as oe,qt as se,r as ce,rr as le,sr as U,tn as ue,un as de,vn as W,w as G,x as fe}from"./button-CX0sWAJl.js";import{_ as K,a as pe,c as me,d as he,g as q,l as ge,m as _e,o as ve,s as ye,u as be,v as xe}from"./fields-BobQ7zRF.js";import{S as Se,_ as Ce,a as we,b as Te,c as Ee,d as De,f as Oe,g as J,h as ke,l as Ae,m as je,n as Me,p as Ne,s as Pe,t as Fe,u as Ie,x as Le,y as Re}from"./useAnchoredPopupScrollLock-BBXJpX5L.js";import{at as ze,ct as Be,ot as Ve,st as He}from"./index-CysBCSxM.js";var Y=e(t(),1);function Ue(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:l=!0,resetMs:u=750,selectedIndex:d=null}=t,f=U(s),p=e.useState(`open`),m=A(),h=Y.useRef(``),g=Y.useRef(d??i??-1),_=Y.useRef(null),v=U(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!c(n)||n?.matches(`:disabled`)?!1:o==null||!B(b,e,o)}function l(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&s(n))return n}return-1}let v=n.current;if(h.current.length>0&&e.key===` `&&(S(e),f?.(!0)),h.current.length>0&&h.current[0]!==` `&&l(v,h.current)===-1&&e.key!==` `&&f?.(!1),v==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;p&&e.key!==` `&&(S(e),f?.(!0));let y=h.current===``;y&&(g.current=d??i??-1),v.every((e,t)=>e&&s(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(u,()=>{h.current=``,g.current=_.current,f?.(!1)});let x=((y?d??i??-1:g.current)??0)+1,C=l(v,h.current,x);C===-1?e.key!==` `&&(h.current=``,f?.(!1)):(a?.(C,e),_.current=C)}),y=U(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);T(r,n)||T(i,n)||(m.clear(),h.current=``,g.current=_.current,f?.(!1))});H(()=>{(p||d===null)&&(m.clear(),_.current=null,h.current!==``&&(h.current=``,f?.(!1)))},[p,d,m,f]);let x=Y.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return Y.useMemo(()=>l?{reference:x,floating:x}:{},[l,x])}function We(e){let[t,n]=Y.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var X=n(),Ge=5;function Z(e,t){let n=Ke(t);return e.clientX>=n.left-Ge&&e.clientX<=n.right+Ge&&e.clientY>=n.top-Ge&&e.clientY<=n.bottom+Ge}function Ke(e){let t=e.getBoundingClientRect(),n=L(e);if(o)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,s=parseFloat(r.height)||0,c=parseFloat(i.width)||0,l=parseFloat(i.height)||0,u=Math.max(t.width,a,c),d=Math.max(t.height,s,l),f=u-t.width,p=d-t.height;return{left:t.left-f/2,right:t.right+f/2,top:t.top-p/2,bottom:t.bottom+p/2}}function qe(e,t){return e??t}var Je=Y.createContext(void 0),Ye=Y.createContext(void 0);function Q(){let e=Y.useContext(Je);if(e===void 0)throw Error(M(60));return e}function Xe(){let e=Y.useContext(Ye);if(e===void 0)throw Error(M(61));return e}var Ze={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Ie(t,r)!==``},hasNullItemLabel:(e,t)=>t?we(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>De(t,e,n)):De(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Qe(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function $e(e,t){return Math.max(0,e-t)}function et(e,t){if(t<=0)return 0;let n=Qe(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function tt(e){let{id:t,value:n,defaultValue:r=null,onValueChange:o,open:c,defaultOpen:l=!1,onOpenChange:u,name:m,form:h,autoComplete:g,disabled:x=!1,readOnly:S=!1,required:C=!1,modal:T=!0,actionsRef:D,inputRef:O,onOpenChangeComplete:k,items:A,multiple:M=!1,itemToStringLabel:N,itemToStringValue:P,isItemEqualToValue:L=Oe,highlightItemOnHover:R=!0,children:ee}=e,{clearErrors:te}=be(),{setDirty:B,setTouched:ne,setFocused:re,validityData:ie,setFilled:ae,name:se,disabled:ce,validation:le,validationMode:ue}=_e(),de=me({id:t}),W=ce||x,G=se??m,[K,pe]=p({controlled:n,default:M?r??b:r,name:`Select`,state:`value`}),[q,ge]=p({controlled:c,default:l,name:`Select`,state:`open`}),ve=Y.useRef([]),xe=Y.useRef([]),Ce=Y.useRef(null),we=Y.useRef(null),Ee=Y.useRef(0),De=Y.useRef(null),J=Y.useRef([]),Ne=Y.useRef(!1),Pe=Y.useRef(null),Fe=Y.useRef(null),ze=Y.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Be=Y.useRef(!1),Ve=Y.useRef(K),{openMethod:He,triggerProps:Ge}=Me(q),Z=y(()=>new j({id:de,labelId:void 0,modal:T,multiple:M,disabled:W,readOnly:S,required:C,highlightItemOnHover:R,itemToStringLabel:N,itemToStringValue:P,isItemEqualToValue:L,value:K,open:q,mounted:q,transitionStatus:void 0,items:A,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:z,triggerProps:z,itemRoot:{props:z,multiple:M,disabled:W,readOnly:S,isItemEqualToValue:L},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:i,setOpen:i,handleScrollArrowVisibility:i,onOpenChangeComplete:i,listRef:ve,popupRef:Ce,scrollHandlerRef:we,scrollArrowsMountedCountRef:Ee,valueRef:De,valuesRef:J,labelsRef:xe,typingRef:Ne,selectionRef:ze,firstItemTextRef:Pe,selectedItemTextRef:Fe,alignItemWithTriggerActiveRef:Be,initialValueRef:Ve},Ze)).current,[Ke,qe]=Y.useState(!1),{mounted:Q,transitionStatus:Xe,forceUnmount:Qe}=fe({open:q,ref:Ce,preventUnmountOnClose:Ke,setPreventUnmountOnClose:qe,onUnmount(){Z.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),k?.(!1)}}),tt=Z.useState(`activeIndex`),nt=Z.useState(`selectedIndex`),rt=Z.useState(`triggerElement`),it=Z.useState(`positionerElement`),at=We(He),ot=He??at,st=Y.useMemo(()=>M?``:Ie(K,P),[M,K,P]),ct=Y.useMemo(()=>M&&Array.isArray(K)?K.map(e=>Ie(e,P)):Ie(K,P),[M,K,P]),lt=d(rt),ut=U(()=>ct);he(lt,de,K,ut,!W,m);let dt=M?Array.isArray(K)&&K.length>0:K!=null&&st!==``;H(()=>{ae(dt)},[dt,ae]),H(function(){let e=je(J.current,K,L,M);e===null&&(Fe.current=null),q||Z.set(`selectedIndex`,e)},[M,q,K,L,Z]),ye(K,()=>{te(G),B(ke(K,ie.initialValue,L)),le.change(K)});let $=U((e,t)=>{let n=t,r=I(n);u?.(e,n),t.isCanceled||(e||qe(r()),ge(e),e||t.reason!==`focus-out`&&t.reason!==`outside-press`||(ne(!0),re(!1),ue===`onBlur`&&le.commit(K)))});Y.useImperativeHandle(D,()=>({unmount:Qe,close:()=>{Z.state.open&&$(!1,F(a))}}),[Qe,$,Z]);let ft=U((e,t)=>{o?.(e,t),t.isCanceled||pe(e)}),pt=U(e=>{let t=$e(e.scrollHeight,e.clientHeight),n=et(e.scrollTop,t),r=n>0,i=n<t;Z.set(`scrollUpArrowVisible`,r),Z.set(`scrollDownArrowVisible`,i)}),mt=Le({open:q,onOpenChange:$,elements:{reference:rt,floating:it}}),ht=Se(mt,{enabled:!W,event:`mousedown`}),gt=w(mt),_t=Te(mt,{enabled:!W,listRef:ve,activeIndex:tt,selectedIndex:nt,disabledIndices:b,onNavigate(e){(e!==null||q)&&Z.set(`activeIndex`,e)},focusItemOnHover:R}),vt=Ue(mt,{enabled:!W&&(q||!S&&!M),listRef:xe,activeIndex:tt,selectedIndex:nt,disabledIndices:e=>v(ve.current[e]),onMatch(e){q?Z.set(`activeIndex`,e):ft(J.current[e],F(oe))},onTyping(e){Ne.current=e}}),yt=Y.useMemo(()=>s(vt.reference,_t.reference,gt.reference,ht.reference,Ge),[ht.reference,vt.reference,_t.reference,gt.reference,Ge]),bt=Y.useMemo(()=>s(V,vt.floating,_t.floating,gt.floating),[vt.floating,_t.floating,gt.floating]),xt=_t.item??z,St=Y.useMemo(()=>({props:xt,multiple:M,disabled:W,readOnly:S,isItemEqualToValue:L}),[xt,M,W,S,L]);Z.useContextCallback(`setValue`,ft),Z.useContextCallback(`setOpen`,$),Z.useContextCallback(`handleScrollArrowVisibility`,pt),Z.useContextCallback(`onOpenChangeComplete`,k),Re(()=>{Z.update({popupProps:bt,triggerProps:yt,itemRoot:St})}),Z.useSyncedValues({id:de,modal:T,multiple:M,disabled:W,readOnly:S,required:C,highlightItemOnHover:R,value:K,open:q,mounted:Q,transitionStatus:Xe,popupProps:bt,triggerProps:yt,itemRoot:St,items:A,itemToStringLabel:N,itemToStringValue:P,isItemEqualToValue:L,openMethod:ot});let Ct=_(O,le.inputRef),wt=M?void 0:G,Tt=Y.useMemo(()=>!M||!Array.isArray(K)||!G?null:K.map(e=>{let t=Ie(e,P);return(0,X.jsx)(`input`,{type:`hidden`,form:h,name:G,value:t,disabled:W},t)}),[M,K,h,G,P,W]);return(0,X.jsxs)(Je.Provider,{value:Z,children:[(0,X.jsx)(Ye.Provider,{value:mt,children:ee}),(0,X.jsx)(`input`,{...le.getValidationProps(W,{onFocus(){Z.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||W||S)return;let t=e.currentTarget.value,n=F(oe,e.nativeEvent);function r(){if(M)return;let e=t.toLowerCase(),r=J.current.findIndex(t=>Ie(t,P).toLowerCase()===e||Ae(t,N).toLowerCase()===e);r===-1&&(r=J.current.findIndex((t,n)=>{let r=xe.current[n];return r!=null&&r.toLowerCase()===e}));let i=J.current[r];i!=null&&ft(i,n)}Z.set(`forceMount`,!0),queueMicrotask(r)}}),id:de&&wt==null?`${de}-hidden-input`:void 0,form:h,name:wt,autoComplete:g,value:st,disabled:W,required:C&&!(M&&dt),readOnly:S,ref:Ct,style:G?f:E,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Tt]})}var nt=`data-popup-side`,rt=400,it={...de,...q,popupSide:e=>e?{[nt]:e}:null,value:()=>null},at=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:c,...f}=e,{setTouched:p,validationMode:m,validation:h,state:g,disabled:_}=_e(),{labelId:v}=ge(),y=Q(),b=y.useState(`readOnly`),x=y.useState(`required`),S=y.useState(`disabled`),C=_||S||a,w=y.useState(`open`),E=y.useState(`mounted`),D=y.useState(`value`),O=y.useState(`triggerProps`),k=y.useState(`positionerElement`),j=y.useState(`listElement`),M=y.useState(`popupSide`),N=y.useState(`id`),P=y.useState(`labelId`),I=y.useState(`hasSelectedValue`),L=E&&k?M:null,R=i??N,te=qe(v,P);me({id:i});let z=d(k),B=Y.useRef(null),V=ve(C,B),{getButtonProps:ne,buttonRef:re}=le({disabled:C,native:o}),H=y.useStateSetter(`triggerElement`),ie=A(),ae=A(),se=A();Y.useEffect(()=>{if(w)return se.start(rt,()=>{y.context.selectionRef.current.allowUnselectedMouseUp=!0,y.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{se.clear()};y.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ae.clear()},[w,y,ae,se]);let ce=s(O,{id:R,role:`combobox`,"aria-expanded":w,"aria-haspopup":`listbox`,"aria-controls":w?j?.id??ue(k)?.id:void 0,"aria-labelledby":te,"aria-readonly":b||void 0,"aria-required":x||void 0,tabIndex:C?-1:0,onFocus(e){V(!0),w&&y.context.alignItemWithTriggerActiveRef.current&&y.context.setOpen(!1,F(oe,e.nativeEvent)),ie.start(0,()=>{y.set(`forceMount`,!0)})},onBlur(e){T(k,e.relatedTarget)||(p(!0),V(!1),m===`onBlur`&&h.commit(D))},onMouseDown(e){if(w)return;let t=ee(e.currentTarget);function n(e){if(!B.current)return;let t=e.target;T(B.current,t)||T(z.current,t)||Z(e,B.current)||y.context.setOpen(!1,F(u,e))}ae.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},f,ne),U=h.getValidationProps(C,ce);U.role=`combobox`;let de={...g,open:w,disabled:C,value:D,readOnly:b,popupSide:L,placeholder:!I};return l(`button`,e,{ref:[t,B,re,H],state:de,stateAttributesMapping:it,props:U})}),ot={value:()=>null},st=Y.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=Q(),u=c.useState(`value`),d=c.useState(`items`),f=c.useState(`itemToStringLabel`),p=c.useState(`hasSelectedValue`),m=!p&&a!=null&&i==null,h=c.useState(`hasNullItemLabel`,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Pe(u,d,f):Ee(u,d,f)),l(`span`,e,{state:g,ref:[t,c.context.valueRef],props:[{children:_},s],stateAttributesMapping:ot})}),ct=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o={open:Q().useState(`open`)};return l(`span`,e,{state:o,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:P})}),lt=Y.forwardRef(function(e,t){let n=Q(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,X.jsx)(g,{ref:t,...e}):null}),ut=Y.createContext(void 0);function dt(){let e=Y.useContext(ut);if(!e)throw Error(M(59));return e}function $(e,t){e&&Object.assign(e.style,t)}var ft={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},pt={position:`fixed`},mt=Y.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:h,alignItemWithTrigger:g=!0,collisionAvoidance:_=m,style:v,...y}=e,b=Q(),S=Xe(),C=b.useState(`open`),w=b.useState(`mounted`),T=b.useState(`modal`),E=b.useState(`value`),D=b.useState(`openMethod`),O=b.useState(`positionerElement`),k=b.useState(`triggerElement`),A=b.useState(`isItemEqualToValue`),j=b.useState(`transitionStatus`),M=Y.useRef(null),N=Y.useRef(null),[P,I]=Y.useState(g),L=w&&P&&D!==`touch`;!w&&P!==g&&I(g),Y.useImperativeHandle(b.context.alignItemWithTriggerActiveRef,()=>L),Fe((L||T)&&C,D===`touch`,O,k);let R=He({anchor:n,floatingRootContext:S,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:h??L,collisionAvoidance:_,keepMounted:!0}),ee=L?`none`:R.side,te=L?pt:R.positionerStyles,z={open:C,side:ee,align:R.align,anchorHidden:R.anchorHidden};H(()=>{b.set(`popupSide`,R.side)},[b,R.side]);let B=b.useStateSetter(`positionerElement`),V=ze(e,z,{styles:te,transitionStatus:j,props:y,refs:[t,B],hidden:!w,inert:!C}),ne=Y.useRef(0),re=U(e=>{if(b.context.valuesRef.current.length===0)return;let t=ne.current;ne.current=e.size;let n=F(oe);if(t!==0&&!b.state.multiple&&E!==null&&Ne(b.context.valuesRef.current,E,A)===-1){let e=b.context.initialValueRef.current,t=e!=null&&Ne(b.context.valuesRef.current,e,A)!==-1?e:null;b.context.setValue(t,n),t===null&&(b.set(`selectedIndex`,null),b.context.selectedItemTextRef.current=null)}if(t!==0&&b.state.multiple&&Array.isArray(E)){let e=E.filter(e=>Ne(b.context.valuesRef.current,e,A)!==-1);e.length!==E.length&&(b.context.setValue(e,n),e.length===0&&(b.set(`selectedIndex`,null),b.context.selectedItemTextRef.current=null))}if(C&&L){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};$(O,e),$(b.context.popupRef.current,e)}}),ie=Y.useMemo(()=>({...R,side:ee,alignItemWithTriggerActive:L,setControlledAlignItemWithTrigger:I,scrollUpArrowRef:M,scrollDownArrowRef:N}),[R,ee,L,I]);return(0,X.jsx)(x,{elementsRef:b.context.listRef,labelsRef:b.context.labelsRef,onMapChange:re,children:(0,X.jsxs)(ut.Provider,{value:ie,children:[w&&T&&(0,X.jsx)(pe,{inert:K(!C),cutout:k}),V]})})}),ht=`base-ui-disable-scrollbar`,gt={className:ht,getElement(e){return(0,X.jsx)(`style`,{nonce:e,href:ht,precedence:`base-ui:low`,children:`.${ht}{scrollbar-width:none}.${ht}::-webkit-scrollbar{display:none}`})}},_t=Y.createContext(void 0),vt={disableStyleElements:!1};function yt(){return Y.useContext(_t)??vt}var bt=`--transform-origin`,xt={...N,...W},St=Y.forwardRef(function(e,t){let{render:n,className:i,style:a,finalFocus:o,...s}=e,c=Q(),u=c.useState(`multiple`),d=c.useState(`readOnly`),f=c.useState(`highlightItemOnHover`),p=Xe(),{side:m,align:h,alignItemWithTriggerActive:g,isPositioned:_,setControlledAlignItemWithTrigger:v}=dt(),y=ie(!0)!=null,b=ne(),{nonce:x,disableStyleElements:S}=yt(),w=c.useState(`id`),T=c.useState(`open`),E=c.useState(`openMethod`),O=c.useState(`mounted`),k=c.useState(`popupProps`),A=c.useState(`transitionStatus`),j=c.useState(`triggerElement`),M=c.useState(`positionerElement`),N=c.useState(`listElement`),P=Y.useRef(!1),I=Y.useRef(!1),z=Y.useRef({}),B=D(),V=U(e=>{if(!M||!c.context.popupRef.current||!I.current)return;let t=M.style.top===`0px`,n=M.style.bottom===`0px`;if(P.current||!g||!t&&!n){c.context.handleScrollArrowVisibility(e);return}let r=Tt(M),i=Et(M.getBoundingClientRect().height,`y`,r),a=ee(M),o=L(M),s=o.getComputedStyle(M),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=Ct(o.getComputedStyle(c.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=wt(e),h=null,_=e=>{M.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=Qe(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(P.current=!0),c.context.handleScrollArrowVisibility(e);return}f-y>1?h=t?1/0:0:n&&p<m&&(h=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),h!=null){let t=Qe(h,0,wt(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(P.current=!0),c.context.handleScrollArrowVisibility(e)});Y.useImperativeHandle(c.context.scrollHandlerRef,()=>V,[V]),C({open:T,ref:c.context.popupRef,onComplete(){T&&c.context.onOpenChangeComplete(!0)}});let re={open:T,transitionStatus:A,side:m,align:h};H(()=>{M&&c.context.popupRef.current&&!Object.keys(z.current).length&&(z.current={top:M.style.top||`0`,left:M.style.left||`0`,right:M.style.right,height:M.style.height,bottom:M.style.bottom,minHeight:M.style.minHeight,maxHeight:M.style.maxHeight,marginTop:M.style.marginTop,marginBottom:M.style.marginBottom})},[c,M]),H(()=>{T||g||(I.current=!1,P.current=!1,$(M,z.current))},[T,g,M]),H(()=>{let e=c.context.popupRef.current;if(!T||!j||!M||!e||g&&!_||c.state.transitionStatus===`ending`)return;if(I.current=!0,e.style.removeProperty(bt),!g){B.request(()=>c.context.handleScrollArrowVisibility(N||e));return}let t=kt(e);try{let t=c.context.selectedItemTextRef.current;t?.isConnected||(t=!c.select(`hasSelectedValue`)&&c.context.firstItemTextRef.current?.isConnected?c.context.firstItemTextRef.current:null);let n=c.context.valueRef.current,r=L(M),i=r.getComputedStyle(M),a=r.getComputedStyle(e),o=ee(j),s=Tt(j),l=Dt(j.getBoundingClientRect(),s),u=Dt(M.getBoundingClientRect(),s),d=l.height,p=N||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),g=parseFloat(i.marginTop)||10,_=parseFloat(i.marginBottom)||10,y=parseFloat(i.minHeight)||100,x=Ct(a),S=o.documentElement.clientHeight-g-_,C=o.documentElement.clientWidth,w=S-l.bottom+d,T,E=b===`rtl`?l.right-u.width:l.left,D=0;if(t&&n){let e=Dt(n.getBoundingClientRect(),s);T=Dt(t.getBoundingClientRect(),s),E=u.left+(b===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;D=T.top-u.top+T.height/2-r}let O=w+D+_+h,k=Math.min(S,O),A=S-g-_,F=O-k,I=C-5;M.style.left=`${Qe(E,5,I-u.width)}px`,M.style.height=`${k}px`,M.style.maxHeight=`none`,M.style.marginTop=`${g}px`,M.style.marginBottom=`${_}px`,e.style.height=`100%`;let R=wt(p),B=F>=R-1;B&&(k=Math.min(S,u.height)-(F-R));let V=l.top<20||l.bottom>S-20||Math.ceil(k)+1<Math.min(m,y),ne=(r.visualViewport?.scale??1)!==1&&te;if(V||ne){$(M,z.current),v(!1);return}let re=Math.max(y,k);if(B){let e=Math.max(0,S-O);M.style.top=u.height>=A?`0`:`${e}px`,M.style.height=`${k}px`,p.scrollTop=wt(p)}else M.style.bottom=`0`,p.scrollTop=F;if(T){let t=u.top,n=u.height,r=T.top+T.height/2,i=Qe(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(bt,`50% ${i}%`)}(re===S||k>=x)&&(P.current=!0),c.context.handleScrollArrowVisibility(p),f&&c.state.selectedIndex===null&&c.state.activeIndex===null&&c.context.listRef.current[0]!=null&&c.set(`activeIndex`,0)}finally{t()}},[c,T,M,j,g,v,B,N,f,b,_]),Y.useEffect(()=>{if(!g||!M||!T)return;let e=L(M);function t(e){c.context.setOpen(!1,F(r,e))}return ae(e,`resize`,t)},[c,g,M,T]);let oe={...N?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":u||void 0,"aria-readonly":d||void 0,id:`${w}-list`},onKeyDown(e){y&&R.has(e.key)&&e.stopPropagation()},onScroll(e){N||V(e.currentTarget)},...g&&{style:N?{height:`100%`}:ft},className:!N&&g?gt.className:void 0},se=l(`div`,e,{ref:[t,c.context.popupRef],state:re,stateAttributesMapping:xt,props:[k,oe,Ve(A),s]});return(0,X.jsxs)(Y.Fragment,{children:[!S&>.getElement(x),(0,X.jsx)(xe,{context:p,modal:!1,disabled:!O,openInteractionType:E,returnFocus:o,restoreFocus:!0,children:se})]})});function Ct(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function wt(e){return $e(e.scrollHeight,e.clientHeight)}function Tt(e){return Be.getScale(e)}function Et(e,t,n){return e/n[t]}function Dt(e,t){return se({x:Et(e.x,`x`,t),y:Et(e.y,`y`,t),width:Et(e.width,`x`,t),height:Et(e.height,`y`,t)})}var Ot=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function kt(e){let{style:t}=e,n={};for(let[e,r]of Ot)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Ot){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var At=Y.createContext(void 0);function jt(){let e=Y.useContext(At);if(!e)throw Error(M(57));return e}var Mt=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...u}=e,d=Y.useRef(null),f=re({guess:!0,label:o,textRef:d}),p=Q(),{props:m,multiple:h,disabled:g,readOnly:_,isItemEqualToValue:v}=p.useState(`itemRoot`),y=g||s,b=p.useState(`isActive`,f.index),x=p.useState(`open`),S=p.useState(`isSelected`,a),C=p.useState(`isSelectedByFocus`,f.index),w=f.index,T=Y.useRef(null);H(()=>{let e=p.context.valuesRef.current;return e[w]=a,()=>{delete e[w]}},[w,a,p]),H(()=>{let e=p.state.value,t=p.state.selectedIndex,n=t,r;h&&Array.isArray(e)?(n=Ce(w,a,p.context.valuesRef.current,e,v,t),r=n===w,w===t&&!r&&(p.context.selectedItemTextRef.current=null)):(r=e!==void 0&&De(a,e,v),r&&(n=w)),p.set(`selectedIndex`,n),r&&d.current&&(p.context.selectedItemTextRef.current=d.current)},[w,h,v,p,a]);let E=Y.useRef(`mouse`),D=Y.useRef(!1),{getButtonProps:A,buttonRef:j}=le({disabled:y,focusableWhenDisabled:!0,native:c,composite:!0}),M={disabled:y,selected:S,highlighted:b};function N(e){if(g||_)return;let t=p.state.value;if(h){let n=Array.isArray(t)?t:[],r=S?J(n,a,v):[...n,a];p.context.setValue(r,F(O,e))}else p.context.setValue(a,F(O,e)),p.context.setOpen(!1,F(O,e))}function P(){p.context.selectionRef.current.dragY=0}let I={role:`option`,"aria-selected":S,tabIndex:x&&b?0:-1,onKeyDown(e){p.set(`activeIndex`,w),e.key===` `&&p.context.typingRef.current&&e.preventDefault()},onClick(e){let t=E.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&k(e.nativeEvent)&&(n!==void 0||b),i=t&&!r&&!D.current;D.current=!1,y||i||N(e.nativeEvent)},onPointerEnter(e){E.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=p.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){E.current=e.pointerType,D.current=!0,P()},onMouseUp(){if(P(),y||E.current===`touch`||D.current)return;let e=!p.context.selectionRef.current.allowSelectedMouseUp&&S,t=!p.context.selectionRef.current.allowUnselectedMouseUp&&!S;e||t||(D.current=!0,T.current?.click(),D.current=!1)}},L=l(`div`,e,{ref:[j,t,f.ref,T],state:M,props:[m,I,u,A]}),R=Y.useMemo(()=>({selected:S,index:w,textRef:d,selectedByFocus:C}),[S,w,d,C]);return(0,X.jsx)(At.Provider,{value:R,children:L})})),Nt=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a,selected:o,...s}=e,c=Y.useRef(null),{transitionStatus:u,setMounted:d}=G(o),f=l(`span`,e,{ref:[t,c],state:{selected:o,transitionStatus:u},props:[{"aria-hidden":!0,children:`✔️`},s],stateAttributesMapping:W});return C({batch:!0,enabled:!o,open:o,ref:c,onComplete(){o||d(!1)}}),f})),Pt=Y.forwardRef(function(e,t){let{selected:n}=jt();return e.keepMounted||n?(0,X.jsx)(Nt,{...e,selected:n,ref:t}):null}),Ft=Y.memo(Y.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=jt(),a=Q(),{render:o,className:s,style:c,...u}=e,d=Y.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]);return l(`div`,e,{ref:[d,t,r],props:u})})),It=`relative flex h-9 w-full min-w-0 items-center gap-2 rounded-control border border-rule bg-page pr-9 pl-3 text-left text-sm text-text outline-none transition-colors focus-visible:border-accent data-popup-open:border-accent disabled:cursor-not-allowed disabled:opacity-60`,Lt=`pointer-events-none size-4 text-muted`,Rt=`max-h-[min(var(--available-height),20rem)] min-w-(--anchor-width) overflow-y-auto rounded-card border border-rule bg-surface p-1 text-text shadow-float outline-none transition-[opacity,transform] duration-150 data-ending-style:-translate-y-1 data-ending-style:opacity-0 data-starting-style:-translate-y-1 data-starting-style:opacity-0`,zt=`relative flex cursor-default items-center rounded-[6px] py-1.5 pr-8 pl-2.5 text-sm outline-none select-none data-disabled:opacity-50 data-highlighted:bg-accent-soft`,Bt=`pointer-events-none absolute right-2.5 size-4 text-accent`;function Vt(e){return(0,X.jsx)(tt,{"data-slot":`select`,...e})}function Ht({className:e,children:t,...n}){return(0,X.jsxs)(at,{"data-slot":`select-trigger`,className:h(It,e),...n,children:[t,(0,X.jsx)(ct,{className:`absolute right-3 flex`,children:(0,X.jsx)(ce,{name:`chevron`,className:Lt})})]})}function Ut({className:e,...t}){return(0,X.jsx)(st,{"data-slot":`select-value`,className:h(`truncate`,e),...t})}function Wt({className:e,...t}){return(0,X.jsx)(lt,{children:(0,X.jsx)(mt,{alignItemWithTrigger:!1,sideOffset:6,className:`z-40`,children:(0,X.jsx)(St,{"data-slot":`select-content`,className:h(Rt,e),...t})})})}function Gt({className:e,children:t,...n}){return(0,X.jsxs)(Mt,{"data-slot":`select-item`,className:h(zt,e),...n,children:[(0,X.jsx)(Ft,{className:`truncate`,children:t}),(0,X.jsx)(Pt,{className:Bt,children:(0,X.jsx)(ce,{name:`check`,className:`size-4`})})]})}export{Vt as a,Ht as c,Nt as d,qe as f,Rt as i,Ut as l,Ue as m,zt as n,Wt as o,Z as p,Bt as r,Gt as s,Lt as t,It as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./companion-view-DINdPF-b.js";import{a as t,n,t as r}from"./jsx-runtime-MZURdZre.js";import{Lr as i,ct as a,et as o,it as s,nt as c,ot as l,r as u,rt as d,zr as f}from"./button-CX0sWAJl.js";import{n as p,r as m,t as h}from"./panel-Csr49lBo.js";import{i as g}from"./steps-CKUno4lh.js";import{d as _,z as v}from"./studio-queries-BflKt9va.js";import{t as y}from"./markdown-view-jMiaBTSO.js";import{c as b}from"./index-CysBCSxM.js";var x=t(n(),1),S=r(),C=`flex w-full min-w-0 items-center gap-2.5 rounded-control border-0 bg-transparent px-2 py-1 text-left text-sm text-text hover:bg-surface-soft aria-[current=true]:bg-accent-soft`;function w(e){return e<1024?`${e} B`:`${(e/1024).toFixed(+(e<10240))} KB`}function T({companion:e,agent:t,name:n}){let[r,a]=(0,x.useState)(void 0),o=f({..._(e,t,n,r),placeholderData:v});if(!o.data)return(0,S.jsx)(p,{title:`Files`,children:o.isError?(0,S.jsx)(`p`,{className:`m-0 text-sm text-muted`,role:`alert`,children:o.error instanceof Error?o.error.message:`The skill could not be read.`}):(0,S.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Listing files…`})});let{files:s,truncated:c,open:l}=o.data;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{title:`Files`,aside:c?`first ${s.length}`:s.length,children:(0,S.jsx)(`ul`,{className:`m-0 -mx-2 grid list-none gap-0.5 p-0`,children:s.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,className:C,"aria-current":l?.path===e.path?`true`:void 0,"data-skill-file":e.path,onClick:()=>a(e.path),children:[(0,S.jsx)(u,{name:`doc`,className:`flex-none text-muted`}),(0,S.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.path}),(0,S.jsx)(`span`,{className:`ml-auto flex-none font-mono text-2xs text-muted`,children:w(e.size)})]})},e.path))})}),l?(0,S.jsxs)(`section`,{className:i(`grid gap-2.5 px-5 py-4`,o.isPlaceholderData&&`opacity-60`),"aria-label":`File ${l.path}`,children:[(0,S.jsx)(`code`,{className:`truncate font-mono text-xs text-muted`,children:l.path}),l.nodes?(0,S.jsx)(`div`,{className:`prose-panel`,children:(0,S.jsx)(y,{nodes:l.nodes})}):(0,S.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:l.note})]}):null]})}var E=[{id:`claude`,label:`Claude`,dir:`.claude/skills`,invoke:e=>`/${e}`},{id:`opencode`,label:`OpenCode`,dir:`.opencode/skills`,invoke:e=>`@${e}`},{id:`agents`,label:`Agents`,dir:`.agents/skills`,invoke:e=>`$${e}`}],D=new Set([`mate-grilling`,`mate-domain-modeling`]);function O(){let e=new Map;for(let t of g({}).paths[0]?.steps??[]){t.skill&&!e.has(t.skill)&&e.set(t.skill,t.label);for(let n of t.alternatives??[])e.has(n.name)||e.set(n.name,t.label)}return e}function k(e,t){let n=[...t.keys()],r=e.filter(e=>t.has(e)).toSorted((e,t)=>n.indexOf(e)-n.indexOf(t)),i=e.filter(e=>D.has(e)),a=e.filter(e=>e.startsWith(`mate-`)&&!t.has(e)&&!D.has(e)),o=e.filter(e=>!e.startsWith(`mate-`)&&!t.has(e));return[{title:`Delivery Path`,hint:`In the order a change meets them`,names:r},{title:`Other Mate skills`,hint:`Run when you need them`,names:a},{title:`Used by other skills`,hint:`Loaded for you, not started on their own`,names:i},{title:`Other skills`,hint:`Installed besides Mate`,names:o}].filter(e=>e.names.length>0)}function A({skills:e,companion:t}){let n=e??{claude:[],opencode:[],agents:[]},[r,u]=(0,x.useState)(`claude`),[f,g]=(0,x.useState)(null),_=O(),v=E.find(e=>e.id===r);return(0,S.jsxs)(`section`,{className:i(s,`grid content-start gap-3 pb-10`),"aria-label":`Agent skills`,"data-skills-root":!0,children:[(0,S.jsx)(l,{label:`Agent`,value:r,onChange:e=>{u(e),g(null)},options:E.map(e=>({value:e.id,label:e.label,count:n[e.id].length}))}),E.map(e=>{let t=e.id===r,o=n[e.id];return(0,S.jsx)(`div`,{id:`skills-panel-${e.id}`,className:t?`grid gap-3`:`hidden`,"aria-hidden":!t,"data-skill-panel":e.id,"data-active":t,children:o.length===0?(0,S.jsxs)(c,{children:[e.label,` has no skills in this companion.`]}):k(o,_).map(e=>(0,S.jsx)(d,{title:e.title,count:e.names.length,hint:e.hint,children:(0,S.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.names.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,className:i(a,`grid grid-cols-[minmax(0,1fr)_auto] py-1.5`),"aria-current":t&&f===e?`true`:void 0,"data-skill":e,onClick:()=>g(e),children:[(0,S.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e}),_.has(e)?(0,S.jsx)(`span`,{className:`text-xs text-muted`,children:_.get(e)}):null]})},e))})},e.title))},e.id)}),(0,S.jsx)(m,{items:k(n[r],_).flatMap(e=>e.names),current:f,onSelect:g,wide:t!==void 0,title:f?`Skill ${f}`:`Skill`,children:f?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(h,{mono:!0,title:f,kicker:_.has(f)?(0,S.jsxs)(`span`,{children:[`Delivery Path · `,_.get(f)]}):(0,S.jsx)(`span`,{children:v.label})}),(0,S.jsx)(p,{title:`Start`,children:D.has(f)?(0,S.jsx)(`p`,{className:`m-0 text-sm`,children:`Used by other skills: they load it when they need it, so it has no start command.`}):(0,S.jsx)(o,{text:v.invoke(f),label:`start command`})}),(0,S.jsx)(p,{title:`Installed for`,children:(0,S.jsx)(`ul`,{className:`m-0 grid list-none gap-1.5 p-0`,children:E.filter(e=>n[e.id].includes(f)).map(e=>(0,S.jsxs)(`li`,{className:`flex items-center gap-3 text-sm`,children:[(0,S.jsx)(`span`,{className:`w-20 text-muted`,children:e.label}),(0,S.jsxs)(`code`,{className:`truncate font-mono text-xs`,children:[e.dir,`/`,f,`/`]})]},e.id))})}),t?(0,S.jsx)(T,{companion:t,agent:r,name:f},`${r}/${f}`):null]}):null})]})}var j=function(){let t=b.useSearch();return(0,S.jsx)(e,{view:`skills`,search:t,children:e=>(0,S.jsx)(A,{skills:e.skillInventory,companion:t.companion})})};export{j as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{Lr as r,ct as i,it as a,lt as o,nt as s,r as c,rt as l,zr as u}from"./button-CX0sWAJl.js";import{it as d,m as f}from"./studio-queries-BflKt9va.js";import"./studio-0ueISxwP.js";import{t as p}from"./fields-BobQ7zRF.js";import{a as m,c as h,l as g,o as _,s as v}from"./select-DdebbX7K.js";import{a as y,i as b,n as x,o as S,r as C,t as w}from"./combobox-BmA8RjOc.js";import{t as ee}from"./markdown-view-jMiaBTSO.js";import{n as te,r as T,t as E}from"./panel-Csr49lBo.js";import{t as D}from"./warnings-B-rvoW8q.js";var O=[`binds`,`in`,`mentions`,`co-change`],k=`Repository root`,A=e=>`spec:${e}`,j=(e,t)=>`openspec/changes/archive/${e}/${t}`,ne=e=>`openspec/specs/${e}/spec.md`,re=/^[a-z0-9][a-z0-9-]{0,63}$/,M=[{id:`show-me`,skill:`mate-show-me`,label:`Show me`,subject:`spec`,prompts:{claude:e=>`/mate-show-me ${e}`,opencode:e=>`Use the mate-show-me skill on spec ${e}.`}}];function N(e){return M.find(t=>t.id===e)??null}var P=e(t(),1),F=`unassigned`,I=e=>e??`(none)`;function L(e){return e.flatMap(e=>e.scopes.length===0?[{repository:null,area:F,spec:e}]:e.scopes.map(t=>({repository:t.repository??null,area:t.area??F,spec:e})))}function R(e,t){return e===t?0:e===null?1:t===null?-1:e.localeCompare(t)}var z=e=>new Set(e.map(e=>e.spec.capability)).size;function B(e,t){let n=L(e),r=Map.groupBy(n,e=>I(e.repository)),i=[...r.entries()].map(([e,t])=>({value:e,repository:t[0].repository,count:z(t)})).toSorted((e,t)=>R(e.repository,t.repository)),a=t!==void 0&&r.get(t)||n;return{repositories:i,areas:[...Map.groupBy(a,e=>`${I(e.repository)}\n${e.area}`).values()].map(e=>{let{repository:t,area:n}=e[0];return{repo:I(t),repository:t,area:n,count:z(e)}}).toSorted((e,t)=>R(e.repository,t.repository)||e.area.localeCompare(t.area))}}function V({repositories:e,areas:t},n){let r=n.q?.trim(),i=e.some(e=>e.value===n.repo)?n.repo:void 0,a=i!==void 0&&t.some(e=>e.area===n.area)?n.area:void 0;return{...r?{q:r}:{},...i===void 0?{}:{repo:i},...a===void 0?{}:{area:a}}}function H(e,t){if(t.repo!==void 0&&I(e.repository)!==t.repo||t.area!==void 0&&e.area!==t.area)return!1;if(!t.q)return!0;let n=t.q.toLowerCase();return e.spec.capability.toLowerCase().includes(n)||e.area.toLowerCase().includes(n)}function U(e,t={}){let n=L(e).filter(e=>H(e,t));return[...Map.groupBy(n,e=>I(e.repository)).values()].map(e=>({repository:e[0].repository,areas:[...Map.groupBy(e,e=>e.area)].map(([e,t])=>({area:e,specs:[...new Set(t.map(e=>e.spec))]})).toSorted((e,t)=>e.area.localeCompare(t.area))})).toSorted((e,t)=>R(e.repository,t.repository))}var W=n(),G=[];function K(e){return e.valid===!1?(0,W.jsx)(o,{marker:`issue`,children:`${e.issueCount??0} issues`}):e.valid===!0?(0,W.jsx)(o,{marker:`done`,children:`valid`}):(0,W.jsx)(o,{marker:`idle`,children:`unvalidated`})}var q=`.`,J=e=>e===q?k:e,Y=e=>e??`No repository`,ie=({repository:e,area:t})=>[e,t===void 0?void 0:J(t)].filter(Boolean).join(` · `),ae=200;function X(e){return e===void 0?`requirements unknown`:`${e} ${e===1?`requirement`:`requirements`}`}var oe={};function se({payload:e,actions:t=G,companion:n,filter:r=oe,onFilterChange:i}){let[a,o]=(0,P.useState)(r);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(D,{warnings:e.warnings}),(0,W.jsx)(pe,{specs:e.specs,actions:t,companion:n,filter:i?r:a,onFilterChange:i??o})]})}var Z={key:``,label:`All Areas`},ce=(e,t)=>e.key===t.key,le=e=>e.label;function ue({specs:e,options:{repositories:t,areas:n},filter:r,search:i,onSearch:a,onChange:o}){let s=r.repo!==void 0,c=[{value:``,label:`All repositories`},...t.map(e=>({value:e.value,label:`${Y(e.repository)} (${e.count})`}))],l=[Z,...n.map(e=>{let t=s?J(e.area):`${Y(e.repository)} · ${J(e.area)}`;return{key:`${e.repo}\n${e.area}`,label:`${t} (${e.count})`,option:e}})],u=l.find(e=>e.option?.repo===r.repo&&e.option?.area===r.area)??Z;return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,role:`search`,"aria-label":`Filter specs`,children:[(0,W.jsx)(p,{type:`search`,className:`w-64 max-sm:w-full`,placeholder:`Search capability or Area`,"aria-label":`Search specs`,value:i,onChange:e=>a(e.currentTarget.value)}),(0,W.jsxs)(m,{items:c,value:r.repo??``,onValueChange:t=>{let n=t||void 0,i=B(e,n).areas.some(e=>e.repo===n&&e.area===r.area);o({...r,repo:n,area:i?r.area:void 0})},children:[(0,W.jsx)(h,{className:`w-auto max-w-72`,"aria-label":`Repository`,children:(0,W.jsx)(g,{})}),(0,W.jsx)(_,{children:c.map(e=>(0,W.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,W.jsxs)(w,{items:l,value:u,onValueChange:e=>o(e?.option?{...r,repo:e.option.repo,area:e.option.area}:{...r,area:void 0}),isItemEqualToValue:ce,itemToStringLabel:le,children:[(0,W.jsx)(b,{className:`w-80 max-sm:w-full`,"aria-label":`Area`,placeholder:`All Areas`}),(0,W.jsxs)(x,{children:[(0,W.jsx)(C,{children:`No Areas match`}),(0,W.jsx)(S,{children:e=>(0,W.jsx)(y,{value:e,children:e.label},e.key)})]})]})]})}var Q=`inline-flex h-7 items-center gap-1.5 rounded-[6px] border border-rule bg-surface px-2.5 text-xs text-text hover:border-accent hover:bg-accent-soft`;function de({capability:e,actions:t}){return!re.test(e)||t.length===0?null:(0,W.jsx)(`span`,{className:`spec-actions flex flex-wrap items-center gap-1.5`,children:t.map(({action:t,runAgents:n,copyAgents:i})=>(0,W.jsxs)(P.Fragment,{children:[n.length>0?(0,W.jsxs)(`button`,{type:`button`,className:r(Q,`spec-action`),"data-studio-action":t.id,"data-studio-subject":e,"data-studio-agents":n.join(` `),children:[(0,W.jsx)(c,{name:`play`,className:`size-3.5`}),t.label]}):null,(0,W.jsxs)(`button`,{type:`button`,className:r(Q,`spec-copy`),"aria-label":`Copy prompt`,"data-studio-copy-prompt":t.id,"data-prompt-claude":i.includes(`claude`)?t.prompts.claude(e):void 0,"data-prompt-opencode":i.includes(`opencode`)?t.prompts.opencode(e):void 0,children:[(0,W.jsx)(c,{name:`copy`,className:`size-3.5`}),`Copy prompt`]})]},t.id))})}function fe({specs:e,open:t,onOpen:n}){return(0,W.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,className:r(i,`grid grid-cols-[minmax(0,1fr)_auto_120px] py-1.5 max-sm:grid-cols-[minmax(0,1fr)_auto]`),"aria-current":t===e.capability?`true`:void 0,"data-spec":e.capability,onClick:()=>n(e.capability),children:[(0,W.jsx)(`span`,{className:`truncate font-mono text-sm`,children:e.capability}),e.valid===!0?(0,W.jsx)(`span`,{}):K(e),(0,W.jsx)(`span`,{className:`text-right text-xs text-muted tabular-nums max-sm:hidden`,children:X(e.requirementCount)})]})},e.capability))})}function pe({specs:e,actions:t,companion:n,filter:i,onFilterChange:o}){let[c,u]=(0,P.useState)(i.q??``),[d,f]=(0,P.useState)(i.q);i.q!==d&&(f(i.q),(i.q??``)!==c.trim()&&u(i.q??``));let p=(0,P.useRef)(void 0);(0,P.useEffect)(()=>()=>clearTimeout(p.current),[]);let m=B(e,i.repo),h=V(m,{...i,q:c}),g=e=>{clearTimeout(p.current),o(e)},_=e=>{u(e),clearTimeout(p.current),p.current=setTimeout(()=>o({...h,q:e.trim()}),ae)},v=()=>{u(``),g({})},y=U(e,h),[b,x]=(0,P.useState)(null),S=[...new Set(y.flatMap(e=>e.areas.flatMap(e=>e.specs.map(e=>e.capability))))],C=e.find(e=>e.capability===b)??null;return(0,W.jsxs)(`section`,{className:r(a,`grid content-start gap-3 pb-10`),"aria-label":`Specs by repository and Area`,children:[e.length===0?(0,W.jsx)(s,{children:`No specs in this companion.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ue,{specs:e,options:m,filter:h,search:c,onSearch:_,onChange:e=>g({...e,q:c.trim()})}),y.length===0?(0,W.jsxs)(s,{className:`flex flex-wrap items-center gap-3`,children:[`No spec matches the search and filters.`,(0,W.jsx)(`button`,{type:`button`,className:Q,onClick:v,children:`Clear filters`})]}):y.map(e=>(0,W.jsxs)(`section`,{className:`grid content-start gap-3`,"aria-label":`Repository ${Y(e.repository)}`,children:[(0,W.jsx)(`h2`,{className:`m-0 mt-2 font-mono text-sm font-semibold text-muted`,children:Y(e.repository)}),e.areas.map(({area:e,specs:t})=>(0,W.jsx)(l,{level:3,title:e===q?J(e):(0,W.jsx)(`span`,{className:`font-mono`,children:e}),label:`Area ${e}`,count:t.length,children:(0,W.jsx)(fe,{specs:t,open:b,onOpen:x})},e))]},e.repository??``))]}),(0,W.jsx)(T,{items:S,current:C?.capability??null,onSelect:x,wide:!0,title:C?`Spec ${C.capability}`:`Spec`,children:C?(0,W.jsx)($,{spec:C,actions:t,companion:n}):null})]})}function $({spec:e,actions:t=G,companion:n,withStatus:r=!0,children:i}){let a=ne(e.capability),o=u({...f(n??``,{path:a}),enabled:!!n}),s=o.data?.open?.markdown;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{mono:!0,title:e.capability,kicker:(0,W.jsxs)(W.Fragment,{children:[r?K(e):null,(0,W.jsx)(`span`,{className:`ml-auto`,children:e.scopes.map(ie).join(`, `)})]}),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(de,{capability:e.capability,actions:t}),(0,W.jsxs)(d,{className:`inline-flex items-center gap-1.5 text-sm`,to:`/vault`,search:e=>({companion:e.companion,studioMode:e.studioMode,path:a}),children:[(0,W.jsx)(c,{name:`external`,className:`size-3.5`}),` Open in Vault`]})]})}),i,(0,W.jsx)(te,{title:`Spec`,aside:e.requirementCount===void 0?void 0:X(e.requirementCount),children:s?(0,W.jsx)(`div`,{className:`prose-panel`,children:(0,W.jsx)(ee,{nodes:s})}):(0,W.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:o.isError?`The spec file could not be read.`:o.isPending&&n?`Loading…`:`The spec file could not be read.`})})]})}export{k as a,O as i,se as n,j as o,N as r,A as s,$ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{$ as r,A as i,H as a,J as o,K as s,L as c,M as l,N as u,Q as d,R as f,W as p,X as m,Y as h,Z as g,j as _,k as v,q as y}from"./studio-queries-BflKt9va.js";var b=e(t(),1),x=n(),S=b.createContext(void 0),C=e=>{let t=b.useContext(S);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},w=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,x.jsx)(S.Provider,{value:e,children:t})),T=()=>c,E=()=>T(),D=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},O=new class extends D{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},k=d;function A(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=k,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var j=A(),M=new class extends D{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function N(e){return Math.min(1e3*2**e,3e4)}function P(e){return(e??`online`)!==`online`||M.isOnline()}var F=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function I(e){let t=!1,n=0,r,i=`pending`,o,s,c=new Promise((e,t)=>{o=e,s=t});c.catch(a);let l=()=>i!==`pending`,u=t=>{if(!l()){let n=new F(t);_(n),e.onCancel?.(n)}},d=()=>{t=!0},f=()=>{t=!1},p=()=>O.isFocused()&&(e.networkMode===`always`||M.isOnline())&&e.canRun(),h=()=>P(e.networkMode)&&e.canRun(),g=e=>{l()||(r?.(),i=`resolved`,o(e))},_=e=>{l()||(r?.(),i=`rejected`,s(e))},v=t=>new Promise(n=>{r=e=>{(l()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,l()||e.onContinue?.()}),y=()=>{if(l())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(g).catch(r=>{if(l())return;let i=e.retry??(E()?0:3),a=e.retryDelay??N,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?_(r):(n++,e.onFail?.(n,r),m(o).then(()=>l()||p()?void 0:v(p)).then(()=>{t?_(r):y()}))})};return{promise:c,status:()=>i,cancel:u,continue:()=>(r?.(),c),cancelRetry:d,continueRetry:f,canStart:h,start:()=>(h()?y():v(h).then(y),c)}}var L=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#e=r.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(E()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(r.clearTimeout(this.#e),this.#e=void 0)}};function R(e){return{onFetch:(t,n)=>{let r=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},d=0,f=async()=>{let n=!1,f=t,p=e=>{v(e,()=>t.signal,()=>n=!0,f[u])},m=l(t.options,t.fetchOptions),h=async(e,r,a)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let o=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:a?`backward`:`forward`,meta:t.options.meta};return p(e),e})(),s=await m(o),{maxPages:c}=t.options,l=a?_:i;return{pages:l(e.pages,s,c),pageParams:l(e.pageParams,r,c)}};if(a&&o.length){let e=a===`backward`,t=e?B:z,n={pages:o,pageParams:s};c=await h(n,t(r,n),e)}else{let t=e??o.length;do{let e=d===0?s[0]===void 0?r.initialPageParam:s[0]:z(r,c);if(d>0&&e==null)break;c=await h(c,e),d++}while(d<t)}return c};t.fetchFn=t.options.persister?()=>t.options.persister?.(f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):f}}}function z(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function B(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var V=class extends L{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=W(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=W(this.options);e.data!==void 0&&(this.setState(U(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=p(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(a).catch(a):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>s(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===h||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>s(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!g(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#o)return this.#a.continueRetry(),this.#o}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperties(e,{[u]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},i=()=>{let e=l(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?R(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=I({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof F&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),s=(async()=>{try{let e=await o.promise;if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof F){if(e.silent){if(this.#a!==o&&this.#o)return this.#o;throw e}if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=s,o.start(),s}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...H(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...U(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),j.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function H(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:P(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function U(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function W(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var G=class extends D{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),q(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return J(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return J(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof s(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!y(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Y(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||s(this.options.enabled,this.#t)!==s(t.enabled,this.#t)||s(this.options.staleTime,this.#t)!==s(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||s(this.options.enabled,this.#t)!==s(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return y(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(a)),t}#h(e){return!E()&&s(this.options.enabled,this.#t)!==!1&&f(e)}#g(){this.#b();let e=s(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=g(this.#r.dataUpdatedAt,e)+1;this.#u=r.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return s(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=r.setInterval(()=>{(this.options.refetchIntervalInBackground||O.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(r.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(r.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,c=e===n?this.#n:e.state,{state:l}=e,u={...l},d=!1,f;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&q(e,t),o=i&&Y(e,n,t,r);(a||o)&&(u={...u,...H(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(u.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:h,status:g}=u;f=u.data;let _=!1;if(t.placeholderData!==void 0&&f===void 0&&g===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,_=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(g=`success`,f=p(i?.data,e,t),d=!0)}if(t.select&&f!==void 0&&!_){if(i&&f===a?.data&&t.select===this.#s)f=this.#c;else try{this.#s=t.select,f=t.select(f),f=p(i?.data,f,t),this.#c=f,this.#o=null}catch(e){this.#o=e}}else f===void 0&&(this.#o=null);this.#o&&(m=this.#o,f=this.#c,h=Date.now(),g=`error`,d=!1);let v=u.fetchStatus===`fetching`,y=g===`pending`,b=g===`error`,x=y&&v,S=f!==void 0;return{status:g,fetchStatus:u.fetchStatus,isPending:y,isSuccess:g===`success`,isError:b,isInitialLoading:x,isLoading:x,data:f,dataUpdatedAt:u.dataUpdatedAt,error:m,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:b&&!S,isPaused:u.fetchStatus===`paused`,isPlaceholderData:d,isRefetchError:b&&S,isStale:X(e,t),refetch:this.refetch,isEnabled:s(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),y(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();j.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function K(e,t){return s(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||s(t.retryOnMount,e)!==!1)}function q(e,t){return K(e,t)||e.state.data!==void 0&&J(e,t,t.refetchOnMount)}function J(e,t,n){if(s(t.enabled,e)!==!1&&s(t.staleTime,e)!==`static`){let r=s(n,e);return r===`always`||r!==!1&&X(e,t)}return!1}function Y(e,t,n,r){return(e!==t||s(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&X(e,n)}function X(e,t){return s(t.enabled,e)!==!1&&e.isStaleByTime(s(t.staleTime,e))}var Z=b.createContext(!1),Q=()=>b.useContext(Z);Z.Provider;function $(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ee=b.createContext($()),te=()=>b.useContext(ee),ne=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?o(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},re=e=>{b.useEffect(()=>{e.clearReset()},[e])},ie=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||o(n,[e.error,r])),ae=(e,t)=>t.state.data===void 0,oe=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},se=(e,t)=>e?.suspense&&t.isPending,ce=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function le(e,t,n){let r=Q(),i=te(),o=C(n),s=o.defaultQueryOptions(e),c=o.getQueryCache().get(s.queryHash),l=e.subscribed!==!1;s._optimisticResults=r?`isRestoring`:l?`optimistic`:void 0,oe(s),ne(s,i,c),re(i);let[u]=b.useState(()=>new t(o,s)),d=u.getOptimisticResult(s);b.useEffect(()=>{u.setOptions(s)},[s,u]);let f=!r&&l;if(b.useSyncExternalStore(b.useCallback(e=>{let t=f?u.subscribe(j.batchCalls(e)):a;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),se(s,d))throw ce(s,u,i);if(ie({result:d,errorResetBoundary:i,throwOnError:s.throwOnError,query:c,suspense:s.suspense}))throw d.error;return s.notifyOnChangeProps?d:u.trackResult(d)}export{L as a,j as c,w as d,C as f,V as i,O as l,ae as n,I as o,G as r,M as s,le as t,D as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,c as t,f as n,o as r,u as i}from"./useBaseQuery-C2cjmeH2.js";import{a,n as o}from"./jsx-runtime-MZURdZre.js";import{F as s,H as c,J as l,q as u}from"./studio-queries-BflKt9va.js";var d=class extends e{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||f(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},i=this.#r=r({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),a=this.state.status===`pending`,o=!i.canStart();try{if(a)t();else{this.#i({type:`pending`,variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:o})}this.state.isPaused&&i.canStart()&&t();let r=await i.start();return await this.#n.config.onSuccess?.(r,e,this.state.context,this,n),await this.options.onSuccess?.(r,e,this.state.context,n),await this.#n.config.onSettled?.(r,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(r,null,e,this.state.context,n),this.#i({type:`success`,data:r}),r}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===i&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let n=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=n(this.state),t.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function f(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var p=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),u(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&s(t.mutationKey)!==s(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??f();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){t.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},m=a(o(),1);function h(e,r){let i=n(r),[a]=m.useState(()=>new p(i,e));m.useEffect(()=>{a.setOptions(e)},[a,e]);let o=m.useSyncExternalStore(m.useCallback(e=>a.subscribe(t.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),s=m.useCallback((...e)=>{a.mutate(e[0],e[1]).catch(c)},[a]);if(o.error&&l(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}export{d as n,h as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,a as t,it as n,lt as r,p as i,tt as a}from"./index-CysBCSxM.js";import{_ as o,at as s,f as c,g as l,h as u,i as d,it as f,m as p,p as m,r as h,u as g}from"./studio-queries-BflKt9va.js";import{t as _}from"./useMutation-DI6LbvVa.js";import{Lr as v,ct as y,n as b,r as x,rt as S,t as C,zr as w}from"./button-CX0sWAJl.js";import{f as T}from"./useBaseQuery-C2cjmeH2.js";import{a as E,n as D,t as O}from"./jsx-runtime-MZURdZre.js";import{a as k}from"./useSelector-AYcH7lB0.js";import{t as A}from"./markdown-view-jMiaBTSO.js";var j=E(D(),1);function M(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function N(e,t){let{shouldBlockFn:n,enableBeforeUnload:r=!0,disabled:i=!1,withResolver:a=!1}=M(e,t),o=k(),{history:s}=o,[c,l]=j.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return j.useEffect(()=>i?void 0:s.block({blockerFn:async e=>{function t(e){let t=o.parseLocation(e),[,n,r]=o.getMatchedRoutes(t.pathname);return r===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}:{routeId:r.id,fullPath:r.fullPath,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let s=await n({action:e.action,current:r,next:i});if(!a)return s;if(!s)return!1;let c=await new Promise(t=>{l({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return l({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),c},enableBeforeUnload:r}),[n,r,i,a,s,o]),c}var P=O(),ee=(e,t)=>`/api/vault/events?${new URLSearchParams({companion:e,path:t})}`;function F(e,t,n){let r=(0,j.useRef)(n);(0,j.useEffect)(()=>{r.current=n}),(0,j.useEffect)(()=>{if(typeof EventSource>`u`)return;let n=new EventSource(ee(e,t));return n.addEventListener(`message`,e=>{try{r.current(JSON.parse(e.data))}catch{}}),()=>n.close()},[e,t])}function I({crumbs:e,children:t}){return(0,P.jsxs)(`div`,{className:`vault-bar sticky top-0 z-2 flex min-h-[52px] items-center gap-2 border-b border-rule-soft bg-[color-mix(in_srgb,var(--bg)_88%,transparent)] px-6 py-2 backdrop-blur-md max-sm:px-3`,children:[(0,P.jsx)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1`,children:e}),t]})}var L=`vault-prose prose mx-auto w-full max-w-[68ch] px-10 pt-10 pb-28 max-sm:px-4`,R=b({variant:`default`,size:`sm`});function z({path:e}){return(0,P.jsxs)(`button`,{type:`button`,className:b({variant:`ghost`,size:`sm`}),"data-copy":e,"data-copy-label":`path`,"aria-label":`Copy path`,children:[(0,P.jsx)(x,{name:`copy`,className:`size-3.5`}),(0,P.jsx)(`span`,{className:`@max-[1000px]:hidden`,children:`Copy path`})]})}function B({companion:e,data:t,writable:n,search:r,crumbs:i}){let a=t.open;return a?n&&r.mode===`edit`?(0,P.jsx)(ne,{companion:e,data:t,crumbs:i},`${a.path}:edit`):(0,P.jsx)(H,{companion:e,data:t,writable:n,crumbs:i},`${a.path}:read`):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(I,{crumbs:i}),(0,P.jsxs)(`div`,{className:L,children:[(0,P.jsx)(`h1`,{className:`text-xl`,children:t.refusal?`File refused`:`Open a markdown file`}),(0,P.jsx)(`p`,{className:t.refusal?`vault-warning text-warn`:`empty text-muted`,children:t.refusal??`Choose a file from the tree to begin.`})]})]})}var V=e=>e.split(`/`).at(-1)??e;function H({companion:e,data:t,writable:n,crumbs:r}){let i=t.open,a=T(),[o,s]=(0,j.useState)(``);return F(e,i.path,t=>{t.kind===`removed`?s(`this file no longer exists on disk`):h(a,e)}),(0,P.jsxs)(`div`,{"data-vault-root":!0,"data-vault-mode":`read`,"data-vault-path":i.path,children:[(0,P.jsxs)(I,{crumbs:r,children:[(0,P.jsx)(z,{path:i.path}),n?(0,P.jsxs)(f,{className:R,id:`vault-mode-edit`,to:`/vault`,search:e=>({...e,mode:`edit`}),"data-vault-mode-link":!0,children:[(0,P.jsx)(x,{name:`pencil`,className:`size-3.5`}),`Edit`]}):(0,P.jsx)(`span`,{className:`text-xs text-muted`,title:`Start Studio with --writable to edit.`,children:`Read only`})]}),(0,P.jsxs)(`article`,{className:L,"aria-label":V(i.path),children:[(0,P.jsx)(A,{nodes:i.markdown}),(0,P.jsx)(`p`,{id:`vault-status`,className:`text-sm text-warn`,"aria-live":`polite`,children:o})]})]})}function te({companion:t,open:n,text:r}){let[i,a]=(0,j.useState)(r);(0,j.useEffect)(()=>{let e=setTimeout(()=>a(r),250);return()=>clearTimeout(e)},[r]);let o=e(`(min-width: 64rem)`),s=i===n.content,c=w({queryKey:[`vault-preview`,t,n.path,i],queryFn:()=>l({data:{companion:t,path:n.path,content:i}}),placeholderData:e=>e,enabled:o&&!s,gcTime:0}),u=s?n.markdown:c.data;return(0,P.jsxs)(`div`,{className:`vault-preview min-h-0 overflow-auto max-lg:hidden`,"aria-label":`Preview`,role:`region`,"data-vault-preview":!0,children:[(0,P.jsx)(`p`,{className:`m-0 px-7 pt-3 text-xs font-semibold text-muted`,children:`Preview`}),(0,P.jsx)(`div`,{className:`prose px-7 pt-2 pb-16 text-sm`,children:u?(0,P.jsx)(A,{nodes:u}):null})]})}function ne({companion:e,data:t,crumbs:n}){let r=t.open,i=T(),c=s(),[l,u]=(0,j.useState)(r.content),[d,p]=(0,j.useState)(r.content),[m,g]=(0,j.useState)(r.token),[y,b]=(0,j.useState)(``),[S,w]=(0,j.useState)(null),E=l!==d,D=(0,j.useRef)(E);(0,j.useEffect)(()=>{D.current=E},[E]);let O=a(e=>e.setDirty);(0,j.useEffect)(()=>O(E),[E,O]),(0,j.useEffect)(()=>()=>O(!1),[O]),N({shouldBlockFn:()=>D.current&&!window.confirm(`Discard unsaved changes?`),enableBeforeUnload:()=>D.current}),F(e,r.path,e=>{if(e.kind===`removed`){b(`this file no longer exists on disk`);return}let t={content:e.content??``,token:e.token??``};e.kind===`overwritten`?(w(t),b(`a version was overwritten; its content is available below`)):E?(w(t),b(`the file changed on disk; unsaved content is still in the editor`)):(u(t.content),p(t.content),g(t.token),b(`updated from disk`))});let k=_({mutationFn:()=>o({data:{companion:e,path:r.path,content:l,token:m}}),onSuccess:t=>{t.kind===`conflict`?(w({content:t.content,token:t.token}),b(t.reason||`save refused`)):(g(t.token),p(l),D.current=!1,O(!1),b(`saved`),h(i,e),c({to:`/vault`,search:e=>({...e,mode:void 0}),resetScroll:!1}))},onError:e=>b(e.message||`save failed`)});return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-vault-root":!0,"data-vault-mode":`edit`,"data-vault-path":r.path,children:[(0,P.jsxs)(I,{crumbs:n,children:[E?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-warn`,children:[(0,P.jsx)(`span`,{className:`size-[7px] rounded-full bg-current`,"aria-hidden":`true`}),`Unsaved`]}):null,(0,P.jsxs)(f,{className:R,id:`vault-mode-read`,to:`/vault`,search:e=>({...e,mode:void 0}),"data-vault-mode-link":!0,children:[(0,P.jsx)(x,{name:`eye`,className:`size-3.5`}),`Read`]}),(0,P.jsx)(C,{variant:`primary`,size:`sm`,id:`vault-save`,onClick:()=>k.mutate(),disabled:k.isPending,children:`Save`})]}),(0,P.jsxs)(`div`,{className:y||S?`grid gap-2 border-b border-rule-soft px-6 py-2.5 text-sm`:`sr-only`,children:[(0,P.jsx)(`p`,{id:`vault-status`,className:`m-0 text-warn`,"aria-live":`polite`,children:y}),S?(0,P.jsxs)(`div`,{id:`vault-incoming`,className:`grid gap-2`,children:[(0,P.jsx)(`strong`,{id:`vault-incoming-title`,className:`text-sm`,children:`Incoming version`}),(0,P.jsx)(`pre`,{id:`vault-incoming-content`,className:`m-0 max-h-40 overflow-auto rounded-control border border-rule bg-surface p-3 font-mono text-xs whitespace-pre-wrap`,children:S.content}),(0,P.jsx)(C,{size:`sm`,id:`vault-recover`,className:`justify-self-start`,onClick:()=>{u(S.content),p(S.content),S.token&&g(S.token),w(null),b(`incoming version loaded into the editor`)},children:`Put incoming content back`})]}):null]}),(0,P.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-2 max-lg:grid-cols-1`,children:[(0,P.jsx)(`textarea`,{id:`vault-editor`,"data-vault-editor":!0,"data-vault-path":r.path,"aria-label":`Markdown source of ${V(r.path)}`,spellCheck:!1,value:l,onChange:e=>u(e.target.value),className:v(`min-h-[60vh] resize-none border-0 border-r border-rule-soft bg-transparent px-6 pt-4 pb-10 font-mono text-[0.86rem] leading-[1.75] text-text outline-none focus-visible:outline-none max-lg:border-r-0`)}),(0,P.jsx)(te,{companion:e,open:r,text:l})]})]})}var U=e=>e.split(`/`).filter(Boolean),W=`flex w-full min-w-0 items-center gap-2 rounded-[6px] border-0 bg-transparent px-2.5 py-1.5 text-left text-sm text-text no-underline hover:bg-surface aria-[current=page]:bg-accent-soft aria-[current=page]:font-semibold`;function G({entry:e,current:t,label:n}){return(0,P.jsxs)(f,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:v(W,`vault-file`),"data-vault-entry":e.path,"aria-current":t?`page`:void 0,children:[(0,P.jsx)(x,{name:`doc`,className:v(`size-3.5`,t?`text-accent`:`text-muted`)}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n??e.name})]})}function K({dir:e,className:t,children:n}){return(0,P.jsx)(f,{to:`/vault`,search:t=>({...t,path:void 0,dir:e??void 0,mode:void 0}),className:t,children:n})}function q({entry:e,companion:t,search:n}){return e.kind===`file`?(0,P.jsx)(G,{entry:e,current:n.path===e.path}):(0,P.jsx)(re,{entry:e,companion:t,search:n})}function re({entry:e,companion:t,search:n}){let[r,i]=(0,j.useState)(e.children!==void 0),a=w({...c(t,e.path),enabled:r&&e.children===void 0}),o=e.children??a.data?.entries;return(0,P.jsxs)(`details`,{className:`vault-directory group/dir`,open:r,"data-vault-dir":e.path,onToggle:e=>i(e.currentTarget.open),children:[(0,P.jsxs)(`summary`,{className:v(W,`cursor-pointer list-none font-semibold [&::-webkit-details-marker]:hidden`),"aria-current":n.dir===e.path?`page`:void 0,children:[(0,P.jsx)(x,{name:`right`,className:`size-3 text-muted transition-transform group-open/dir:rotate-90`}),(0,P.jsx)(x,{name:`folder`,className:`size-3.5 text-muted`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]}),(0,P.jsxs)(`div`,{className:`vault-children grid gap-px pl-3.5`,children:[r&&o?o.map(e=>(0,P.jsx)(q,{entry:e,companion:t,search:n},e.path)):null,a.error?(0,P.jsx)(`p`,{className:`vault-warning m-0 px-2.5 py-1 text-xs text-warn`,children:a.error.message}):null]})]})}var J=`m-0 px-2.5 py-1.5 text-sm text-muted`,Y=`vault-warning m-0 px-2.5 py-1.5 text-xs text-warn`;function ie({data:e,companion:t,search:n}){return e.failure?(0,P.jsx)(`div`,{"data-vault-slot":`tree`,children:(0,P.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]})}):e.tree===null?(0,P.jsx)(`div`,{"data-vault-slot":`tree`,"aria-busy":`true`,children:(0,P.jsx)(`p`,{className:v(J,`empty`),children:`Listing files…`})}):(0,P.jsxs)(`div`,{"data-vault-slot":`tree`,"data-vault-generation":e.generation??void 0,children:[(0,P.jsx)(ae,{data:e}),e.tree.length===0?(0,P.jsx)(`p`,{className:v(J,`empty`),children:`This companion has no markdown files.`}):(0,P.jsx)(`nav`,{className:`vault-tree grid gap-px`,"aria-label":`Markdown files`,children:e.tree.map(e=>(0,P.jsx)(q,{entry:e,companion:t,search:n},e.path))})]})}function ae({data:e}){return e.warning?(0,P.jsxs)(`p`,{className:Y,children:[e.warning,`. The tree may be out of date.`]}):e.watching?null:(0,P.jsx)(`p`,{className:Y,children:`The tree may be out of date.`})}function oe({companion:e,query:t,search:n}){let[r,i]=(0,j.useState)(t);(0,j.useEffect)(()=>{let e=setTimeout(()=>i(t),150);return()=>clearTimeout(e)},[t]);let a=w({...m(e,r),enabled:r.trim().length>0});if(!a.data)return null;let{shown:o,total:s}=a.data,c=s-o.length;return(0,P.jsxs)(`div`,{"data-vault-filter-results":!0,children:[o.length===0?(0,P.jsx)(`p`,{className:v(J,`empty`),children:`No files match.`}):(0,P.jsx)(`nav`,{className:`vault-tree vault-results grid gap-px`,"aria-label":`Matching files`,children:o.map(e=>(0,P.jsx)(G,{entry:e,current:n.path===e.path,label:e.path},e.path))}),c>0?(0,P.jsxs)(`p`,{className:J,"data-vault-more":!0,children:[c,` more match`,c===1?``:`es`,`; refine the filter.`]}):null]})}var X=`vault-crumb rounded-[6px] px-1.5 py-0.5 text-sm text-muted no-underline hover:bg-surface hover:text-text`;function se({rootName:e,search:t}){let n=U(t.path??t.dir??``);return(0,P.jsx)(`nav`,{className:`vault-breadcrumb min-w-0`,"aria-label":`Breadcrumb`,"data-vault-crumb":!0,children:(0,P.jsxs)(`ol`,{className:`m-0 flex min-w-0 list-none items-center gap-0.5 overflow-hidden p-0 text-sm text-muted`,children:[(0,P.jsx)(`li`,{className:`flex-none`,children:n.length===0?(0,P.jsx)(`span`,{"aria-current":`page`,className:`px-1.5 font-semibold text-text`,children:e}):(0,P.jsx)(K,{dir:null,className:X,children:e})}),n.map((e,t)=>{let r=n.slice(0,t+1).join(`/`),i=t===n.length-1;return(0,P.jsxs)(`li`,{className:v(`flex items-center gap-0.5`,i?`min-w-0`:`flex-none max-md:hidden`),children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i?(0,P.jsx)(`span`,{"aria-current":`page`,className:`truncate px-1.5 font-semibold text-text`,children:e}):(0,P.jsx)(K,{dir:r,className:X,children:e})]},r)})]})})}function ce(e,t){let n=e;for(let e of U(t)){let t=n?.find(t=>t.kind===`directory`&&t.name===e);if(!t)return null;n=t.children}return n??null}function le({data:e,rootName:t}){let n=e.failure?(0,P.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]}):e.tree===null?(0,P.jsx)(`p`,{className:v(J,`empty`),children:`Listing files…`}):null,r=e.dir?U(e.dir):[],i=r.at(-1)??t;if(n)return(0,P.jsx)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto w-full max-w-[820px] px-10 py-8`,"aria-busy":e.tree===null,children:n});let a=(e.dir?ce(e.tree,e.dir):null)??e.tree;return(0,P.jsxs)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto grid w-full max-w-[820px] gap-4 px-10 py-8 max-sm:px-4`,children:[(0,P.jsx)(`h1`,{className:`m-0 text-xl font-semibold`,children:i}),e.dirMissing?(0,P.jsx)(`p`,{className:Y,children:`That folder is not in the tree; showing the root.`}):null,a.length===0&&r.length===0?(0,P.jsx)(`p`,{className:v(J,`empty`),children:`This companion has no markdown files.`}):(0,P.jsx)(S,{title:`In this folder`,count:a.length,children:(0,P.jsxs)(`ul`,{className:`vault-rows m-0 list-none p-0`,"aria-label":`Folder contents`,children:[r.length>0?(0,P.jsx)(`li`,{children:(0,P.jsxs)(K,{dir:r.length>1?r.slice(0,-1).join(`/`):null,className:v(y,`vault-row py-1.5`),children:[(0,P.jsx)(x,{name:`left`,className:`text-muted`}),(0,P.jsx)(`span`,{children:`..`})]})}):null,a.map(e=>(0,P.jsx)(`li`,{children:e.kind===`directory`?(0,P.jsxs)(K,{dir:e.path,className:v(y,`vault-row py-1.5 font-semibold`),children:[(0,P.jsx)(x,{name:`folder`,className:`text-muted`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]}):(0,P.jsxs)(f,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:v(y,`vault-row py-1.5`),children:[(0,P.jsx)(x,{name:`doc`,className:`text-muted`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.path))]})})]})}function Z(e){return typeof e==`string`?e:(e.c??[]).map(Z).join(``)}function ue(e){return(e??[]).filter(e=>typeof e!=`string`&&e.t===`h2`).map((e,t)=>({index:t,text:Z(e)}))}var Q=e=>[...e?.querySelectorAll(`article .markdown-body h2`)??[]];function de(e,t,n){let[r,i]=(0,j.useState)(null);return(0,j.useEffect)(()=>{if(!t)return;let n=e.current,r=Q(n);if(r.length===0||typeof IntersectionObserver>`u`)return;let a=new IntersectionObserver(e=>{let t=e.find(e=>e.isIntersecting);t&&i(r.indexOf(t.target))},{root:n,rootMargin:`-60px 0px -70% 0px`});for(let e of r)a.observe(e);return()=>a.disconnect()},[e,t]),{current:r!==null&&r<n?r:0,go:t=>{Q(e.current)[t]?.scrollIntoView({behavior:`smooth`,block:`start`}),i(t)}}}function fe({headings:e,current:t,go:n}){return(0,P.jsxs)(`nav`,{className:`vault-outline min-h-0 overflow-auto border-l border-rule-soft px-5 pt-[72px] pb-6 @max-[1080px]:hidden`,"aria-label":`Outline`,children:[(0,P.jsx)(`h2`,{className:`m-0 mb-2 text-xs font-semibold text-muted`,children:`On this page`}),(0,P.jsx)(`ol`,{className:`m-0 grid list-none gap-0.5 p-0`,children:e.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:v(`block w-full truncate rounded-r-[8px] border-0 bg-transparent px-2.5 py-1 text-left text-sm text-text hover:bg-surface`,t===e.index&&`font-semibold text-accent shadow-[inset_2px_0_0_var(--accent)]`),"aria-current":t===e.index?`location`:void 0,onClick:()=>n(e.index),children:e.text})},e.index))})]})}var pe=[],$=(e,t)=>[e?`272px`:null,`minmax(0,1fr)`,t?`232px`:null].filter(Boolean).join(` `);function me({data:e,companion:t,search:r,stale:i,refresh:a,filter:o,setFilter:s,hidden:c}){return(0,P.jsxs)(`aside`,{hidden:c,className:`vault-tree-panel flex min-h-0 flex-col border-r border-rule @max-[720px]:max-h-[40vh] @max-[720px]:border-r-0 @max-[720px]:border-b`,id:`vault-tree-panel`,"aria-label":`Files`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between pt-3 pr-2.5 pb-2 pl-5`,children:[(0,P.jsx)(`strong`,{className:`text-sm`,children:`Files`}),(0,P.jsx)(n,{label:`Refresh tree`,side:`bottom`,children:(0,P.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":a.isPending?`Refreshing…`:`Refresh tree`,onClick:()=>a.mutate(),disabled:a.isPending,children:(0,P.jsx)(x,{name:`refresh`,className:a.isPending?`animate-spin`:void 0})})})]}),(0,P.jsx)(`p`,{id:`vault-stale`,className:Y+` mx-2.5`,role:`status`,hidden:!i,children:`Files changed — refresh tree.`}),a.error?(0,P.jsx)(`p`,{className:Y+` mx-2.5`,role:`status`,children:a.error.message}):null,(0,P.jsxs)(`label`,{className:`mx-3.5 mb-2 flex h-[34px] items-center gap-2 rounded-control border border-rule bg-surface pr-2 pl-2.5 text-muted focus-within:border-accent`,children:[(0,P.jsx)(x,{name:`search`,className:`size-3.5`}),(0,P.jsx)(`input`,{type:`search`,id:`vault-filter`,className:`vault-filter min-w-0 flex-1 border-0 bg-transparent text-sm text-text outline-none placeholder:text-muted`,placeholder:`Go to file`,"aria-label":`Go to file`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&s(``)}})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-2.5 pb-6`,children:o.trim()?(0,P.jsx)(oe,{companion:t,query:o,search:r}):(0,P.jsx)(ie,{data:e,companion:t,search:r})})]})}function he({companion:e,rootName:t,writable:r,search:o}){let s=T(),c=w(p(e,o)),l=w({...p(e,o,!0),enabled:!(!c.data||c.data.tree!==null||c.data.failure)}).data??c.data,[f,m]=(0,j.useState)(``),h=a(e=>e.latestGeneration),g=a(e=>e.treeHidden),v=a(e=>e.toggleTree),y=a(e=>e.hydrate);(0,j.useEffect)(y,[y]);let b=_({mutationFn:()=>u({data:{companion:e,path:o.path,dir:o.dir,refresh:!0,wait:!0}}),onSuccess:t=>void d(s,e,o,t)}),S=(0,j.useRef)(null),E=!!l?.open&&o.mode!==`edit`,D=E?ue(l?.open?.markdown):pe,O=de(S,E?l?.open?.markdown:void 0,D.length);if(!l)return(0,P.jsx)(i,{});let k=h!==null&&l.generation!==null&&h>l.generation,A=D.length>0,M=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(n,{label:g?`Show files`:`Hide files`,side:`bottom`,children:(0,P.jsx)(C,{size:`icon-sm`,variant:`ghost`,id:`vault-tree-toggle`,"aria-controls":`vault-tree-panel`,"aria-expanded":!g,"aria-label":g?`Show files`:`Hide files`,onClick:v,children:(0,P.jsx)(x,{name:`sidebar`})})}),(0,P.jsx)(se,{rootName:t,search:o})]});return(0,P.jsx)(`div`,{className:`@container flex min-h-0 flex-1 flex-col`,children:(0,P.jsxs)(`section`,{className:`vault-layout grid min-h-0 flex-1 border-t border-rule @max-[720px]:grid-cols-1!`,style:{"--vault-wide":$(!0,A),"--vault-wide-bare":$(!1,A),"--vault-narrow":$(!0,!1),"--vault-narrow-bare":$(!1,!1)},"data-vault-layout":!0,children:[(0,P.jsx)(me,{data:l,companion:e,search:o,stale:k,refresh:b,filter:f,setFilter:m,hidden:g}),(0,P.jsx)(`div`,{ref:S,className:`vault-main min-h-0 min-w-0 overflow-auto scroll-smooth`,"data-vault-main":!0,"data-vault-pane":!0,children:o.path||l.open||l.refusal?(0,P.jsx)(B,{companion:e,data:l,writable:r,search:o,crumbs:M}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(I,{crumbs:M}),(0,P.jsx)(le,{data:l,rootName:t})]})}),A?(0,P.jsx)(fe,{headings:D,...O}):null]})})}function ge(){let e=t.useSearch(),{data:n}=r(g({companion:e.companion,studioMode:e.studioMode}));if(!e.companion||!n.selected)return null;let i=n.selected.path.split(/[\\/]/).findLast(Boolean)??`companion`;return(0,P.jsx)(he,{companion:e.companion,rootName:i,writable:n.writable,search:{path:e.path,dir:e.dir,mode:e.mode}})}export{ge as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Lr as e,it as t}from"./button-CX0sWAJl.js";import{t as n}from"./jsx-runtime-MZURdZre.js";var r=n();function i({warnings:n}){return n.length===0?null:(0,r.jsx)(`section`,{className:e(t,`pb-4`),"aria-label":`Warnings`,children:(0,r.jsxs)(`div`,{className:`warnings grid gap-1.5 rounded-card border border-[color-mix(in_srgb,var(--warn)_35%,var(--border))] bg-warn-soft px-4 py-3 text-sm`,children:[(0,r.jsx)(`h2`,{className:`m-0 text-sm font-semibold text-warn`,children:`Some data could not be read`}),(0,r.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:n.map(e=>(0,r.jsx)(`li`,{children:e},e))})]})})}export{i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Lr as e,et as t,it as n,ot as r,rt as i,tt as a,zr as o}from"./button-CX0sWAJl.js";import{D as s,T as c,i as l,k as u,m as d}from"./index-CysBCSxM.js";import{a as f}from"./studio-queries-BflKt9va.js";import{t as p}from"./companion-view-DINdPF-b.js";import{p as m}from"./studio-0ueISxwP.js";import{t as h}from"./warnings-B-rvoW8q.js";import{a as g,n as _,t as v}from"./jsx-runtime-MZURdZre.js";import{n as y,r as b,t as x}from"./panel-Csr49lBo.js";import{i as S,n as C,r as ee,t as w}from"./steps-CKUno4lh.js";var T=g(_(),1),E=e=>({id:e.id,kind:`stage`,step:e});function D(e){let t=e.map.map(e=>e.kind===`stage`?{nodes:[E(e.step)],optional:e.step.optional,phase:e.step.phase}:e.group===`human`?{nodes:[{id:C(e.steps[0]),kind:`review-group`,steps:e.steps}],optional:e.steps[0].optional,phase:e.steps[0].phase}:{nodes:e.steps.map(E),optional:!0,phase:e.steps[0].phase});return t.unshift({nodes:[{id:`start`,kind:`start`}],optional:!1,phase:t[0]?.phase??`plan`}),t}function O(e){return e.kind===`stage`?!!e.step.sessionBreakBefore:e.kind===`review-group`&&!!e.steps[0].sessionBreakBefore}function k(e){let t=[],n=(e,n,r)=>{for(let i of e)for(let e of n)t.push({from:i.id,to:e.id,kind:r,newSession:O(e)})};return e.forEach((t,r)=>{let i=e[r+1];i&&n(t.nodes,i.nodes,`flow`);let a=e[r-1];t.optional&&a&&i&&n(a.nodes,i.nodes,`bypass`)}),t}function A(e){let t=[];return e.forEach((e,n)=>{let r=t.at(-1);r?.phase===e.phase?r.to=n+1:t.push({phase:e.phase,label:w[e.phase],from:n,to:n+1})}),t}function j(e){let t=e.findIndex(e=>e.nodes.some(e=>e.id===`submit`));return t===-1?null:{from:0,to:t+1}}function M(e){let t=D(e),n=Math.max(1,...t.map(e=>e.nodes.length)),r=t.flatMap((e,t)=>e.nodes.map((r,i)=>e.nodes.length===1?{...r,column:t,row:0,rowSpan:n}:{...r,column:t,row:i,rowSpan:1}));return{columns:t.length,rows:n,nodes:r,edges:k(t),bands:A(t),cycle:j(t)}}var N=e=>e.rows*2+1;function P(e){return{along:e.column+.5,across:e.row*2+e.rowSpan}}var F=e=>Math.round(e*1e4)/1e4,I=(e,t)=>`${F(e/t*100)}%`,L=({along:e,across:t})=>`${F(t)} ${F(e)}`;function R(e,t){let n=t=>{let n=e.nodes.find(e=>e.id===t);if(!n)throw Error(`Unknown graph node: ${t}`);return P(n)};return[n(t.from),n(t.to)]}function z(e,t){let[n,r]=R(e,t);if(t.kind===`bypass`){let t=N(e);return`M ${L(n)} C ${L({along:n.along,across:t})}, ${L({along:r.along,across:t})}, ${L(r)}`}let i=(n.along+r.along)/2;return`M ${L(n)} C ${L({along:i,across:n.across})}, ${L({along:i,across:r.across})}, ${L(r)}`}function B(e,t){let[n,r]=R(e,t),i=(n.along+r.along)/2;return t.kind===`bypass`?{along:i,across:(n.across+r.across)/8+N(e)*3/4}:{along:i,across:(n.across+r.across)/2}}function V(e,t){return{x:I(t.across,N(e)),y:I(t.along,e.columns)}}function H(e,t){return{top:I(t.from,e.columns),height:I(t.to-t.from,e.columns)}}var U=v(),W={},G=[];function K({payload:e,counts:t=W,changesByStage:n=G}){let r=S({skills:e.skills&&e.skills.length>0?e.skills:void 0,topology:e.topology,workflow:e.workflow}),[i,a]=(0,T.useState)(r.paths[0].schema),o=r.paths.find(e=>e.schema===i)??r.paths[0];return(0,U.jsx)(`section`,{className:`workflow-delivery-path @container grid content-start gap-2`,"aria-label":`Delivery Path`,children:(0,U.jsx)(q,{path:o,paths:r.paths,onSchemaChange:a,counts:t,changesByStage:n})})}function q({path:t,paths:o,onSchemaChange:s,counts:c,changesByStage:l}){let[u,d]=(0,T.useState)(null),f=t.steps.find(e=>e.id===u)??null,p=l.filter(e=>e.changes.length>0);return(0,U.jsxs)(`div`,{className:e(n,`workflow-path grid grid-cols-[minmax(380px,520px)_minmax(260px,1fr)] items-start gap-10 pt-10 pb-12 @max-[880px]:grid-cols-1`),"data-workflow-schema-panel":t.schema,children:[(0,U.jsxs)(`div`,{className:`workflow-path-graph grid min-w-0 justify-items-center gap-9 px-8 pt-4`,children:[(0,U.jsx)(Z,{path:t,selected:u,onSelect:d,counts:c}),(0,U.jsx)(te,{})]}),(0,U.jsxs)(`div`,{className:`workflow-detail-overview grid content-start gap-5`,id:J(t),children:[(0,U.jsxs)(`div`,{className:`grid gap-2 text-sm leading-relaxed text-muted`,children:[(0,U.jsx)(`p`,{className:`workflow-description m-0 text-text`,children:t.description}),t.reviewsKnown?null:(0,U.jsx)(`p`,{className:`workflow-description m-0`,children:`The schema's artifacts could not be read, so its review stages are unknown.`}),(0,U.jsx)(`p`,{className:`workflow-description m-0`,children:`A workset is one or more changes published together: after Submit change, start again at the top for the next change, and publish once the workset is merged.`}),(0,U.jsx)(`p`,{className:`workflow-detail-hint m-0`,children:`Choose a stage to see what it does and the prompt that runs it.`})]}),p.length>0?(0,U.jsx)(i,{title:`Where your changes are`,children:(0,U.jsx)(`ul`,{className:`m-0 list-none p-0`,children:p.map(e=>(0,U.jsxs)(`li`,{className:`grid gap-1 border-t border-rule-soft px-4 py-2 first:border-t-0`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[e.label,(0,U.jsx)(a,{value:e.changes.length})]}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-muted`,children:e.changes.join(`, `)})]},e.node))})}):null]}),(0,U.jsx)(b,{items:t.steps.map(e=>e.id),current:f?.id??null,onSelect:d,title:f?`Stage ${f.label}`:`Stage`,children:f?(0,U.jsx)(re,{step:f,stepsKnown:t.stepsKnown,changes:l.find(e=>e.node===C(f))?.changes??[],children:f.kind===`human`?(0,U.jsx)(y,{title:`OpenSpec schema`,children:(0,U.jsxs)(`div`,{className:`grid gap-2`,"data-workflow-schema-root":!0,children:[o.length>1?(0,U.jsx)(r,{label:`OpenSpec schema`,value:t.schema,onChange:e=>{let t=o.find(t=>t.schema===e);t&&(t.steps.some(e=>e.id===u)||d(t.steps.find(e=>e.kind===`human`)?.id??null),s(e))},options:o.map(e=>({value:e.schema,label:e.label}))}):(0,U.jsx)(`code`,{className:`font-mono text-sm`,children:t.label}),(0,U.jsx)(`span`,{className:`text-sm text-muted`,children:t.tagline})]})}):null}):null})]})}var J=e=>`workflow-${e.schema}-overview`,Y=(e,t,n)=>e.startsWith(`reviews`)?`${n} ${n===1?`change waits`:`changes wait`} for review`:`${n} ${n===1?`change`:`changes`} at ${t}`;function X({count:e,name:t}){return e?(0,U.jsx)(`span`,{className:`workflow-graph-count absolute -top-2.5 -right-2.5 z-1 inline-grid h-5 min-w-5 place-items-center rounded-full border border-[color-mix(in_srgb,var(--accent)_45%,var(--border))] bg-accent-soft px-1.5 font-sans text-2xs font-bold text-text`,"aria-label":t,role:`img`,children:e}):null}function Z({path:e,label:t=`Delivery Path map`,selected:n=null,onSelect:r,counts:i=W}){let a=M(e),o=!r;return(0,U.jsxs)(`nav`,{className:`workflow-graph`,"aria-label":t,style:{"--graph-columns":String(a.columns),"--graph-rows":String(a.rows)},children:[(0,U.jsxs)(`div`,{className:`workflow-graph-bands`,"aria-hidden":`true`,children:[a.bands.map(e=>(0,U.jsx)(`div`,{className:`workflow-graph-band`,"data-band":e.phase,style:H(a,e),children:e.label},e.phase)),a.cycle?(0,U.jsx)(`div`,{className:`workflow-graph-cycle`,style:H(a,a.cycle),children:(0,U.jsx)(`span`,{children:`repeats for each change`})}):null,(0,U.jsx)(`div`,{className:`workflow-graph-workset`,children:(0,U.jsx)(`span`,{children:`workset`})})]}),(0,U.jsx)(ne,{graph:a}),(0,U.jsx)(`ol`,{className:`workflow-graph-nodes`,children:a.nodes.map(e=>e.kind===`start`?null:(0,U.jsx)(`li`,{className:`workflow-graph-node`,"data-node-kind":e.kind,style:{"--graph-row":String(e.column+1),"--graph-lane":String(e.row+1),"--graph-span":String(e.rowSpan)},children:e.kind===`stage`?(0,U.jsxs)(`span`,{className:`relative max-w-full`,children:[(0,U.jsx)($,{step:e.step,box:!0,plain:o,current:n===e.step.id,onSelect:r}),o?null:(0,U.jsx)(X,{count:i[e.id],name:Y(e.id,e.step.label,i[e.id]??0)})]}):(0,U.jsxs)(`div`,{className:`workflow-graph-box workflow-graph-group relative`,"data-map-group":`human`,"data-current":e.steps.some(e=>e.id===n)?`true`:void 0,children:[o?(0,U.jsx)(`span`,{className:`workflow-graph-group-label`,children:Q(e.steps)}):(0,U.jsx)(`button`,{type:`button`,className:`workflow-graph-group-label cursor-pointer rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,onClick:()=>r?.(e.steps[0].id),children:Q(e.steps)}),(0,U.jsx)(`ol`,{children:e.steps.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)($,{step:e,plain:o,current:n===e.id,onSelect:r})},e.id))}),o?null:(0,U.jsx)(X,{count:i[e.id],name:Y(e.id,Q(e.steps),i[e.id]??0)})]})},e.id))})]})}function Q(e){let[t]=e;return t?.kind===`human`?t.groupLabel:`Human review`}function te(){return(0,U.jsxs)(`ul`,{className:`workflow-graph-legend`,"aria-hidden":`true`,children:[(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-optional`}),`optional`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-graph-openspec`}),`OpenSpec`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-session`}),`new session`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-skip`}),`can be skipped`]})]})}function ne({graph:e}){return(0,U.jsxs)(`svg`,{className:`workflow-graph-layer`,"aria-hidden":`true`,focusable:`false`,children:[(0,U.jsx)(`svg`,{viewBox:`0 0 ${N(e)} ${e.columns}`,preserveAspectRatio:`none`,overflow:`visible`,children:e.edges.map(t=>(0,U.jsx)(`path`,{className:`workflow-graph-edge`,d:z(e,t),"data-edge-kind":t.kind,"data-edge-from":t.from,"data-edge-to":t.to,"data-new-session":t.newSession?`true`:void 0},`${t.kind}-${t.from}-${t.to}`))}),e.nodes.map(t=>{if(t.kind!==`start`)return null;let{x:n,y:r}=V(e,P(t));return(0,U.jsx)(`circle`,{className:`workflow-graph-start`,cx:n,cy:r,r:`3.5`},t.id)}),e.edges.map(t=>{if(!t.newSession)return null;let{x:n,y:r}=V(e,B(e,t));return(0,U.jsx)(`circle`,{className:`workflow-graph-session`,"data-session-mark":t.to,cx:n,cy:r,r:`3.5`},`${t.from}-${t.to}`)})]})}function $({step:e,box:t,plain:n,current:r,onSelect:i}){let a={className:t?`workflow-graph-link workflow-graph-box`:`workflow-graph-link`,"data-map-stage":e.id,"data-stage-kind":e.kind,"data-optional":e.optional?`true`:void 0},o=(0,U.jsxs)(U.Fragment,{children:[e.badges.includes(`openspec`)?(0,U.jsx)(`span`,{className:`workflow-graph-openspec`,"aria-hidden":`true`}):null,e.kind===`human`?e.artifact:e.label]});return n?(0,U.jsx)(`span`,{...a,children:o}):(0,U.jsx)(`button`,{type:`button`,...a,"aria-label":e.kind===`human`?e.label:void 0,"aria-current":r?`true`:void 0,onClick:()=>i?.(e.id),children:o})}function re({step:e,stepsKnown:t,changes:n,children:r}){return(0,U.jsxs)(`article`,{className:`workflow-card`,"data-stage":e.id,"data-stage-kind":e.kind,"data-optional":e.optional?`true`:void 0,children:[(0,U.jsx)(x,{title:e.label,kicker:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:w[e.phase]}),e.optional?(0,U.jsx)(`span`,{children:`· optional`}):null,e.kind===`human`?(0,U.jsx)(`span`,{className:`text-why`,children:`· human review`}):null,e.badges.includes(`openspec`)?(0,U.jsx)(`span`,{children:`· OpenSpec`}):null]}),children:e.skill||e.sessionBreakBefore?(0,U.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm text-muted`,children:[e.skill?(0,U.jsx)(`code`,{className:`font-mono text-text`,children:e.skill}):null,e.sessionBreakBefore?(0,U.jsxs)(`span`,{className:`workflow-card-session inline-flex items-center gap-1.5 text-accent`,children:[(0,U.jsx)(`span`,{className:`size-2 rounded-full border-[1.5px] border-accent`,"aria-hidden":`true`}),`New session / clean chat`]}):null]}):null}),r,(0,U.jsxs)(y,{title:e.kind===`human`?`How it runs`:`Run`,children:[(0,U.jsx)(ie,{step:e}),e.missingSkill?(0,U.jsxs)(`p`,{className:`workflow-missing-skill m-0 text-sm text-warn`,role:`note`,children:[`Skill not reported for this companion:`,` `,(0,U.jsx)(`code`,{className:`font-mono`,children:e.missingSkill}),`. Run`,` `,(0,U.jsx)(`code`,{className:`font-mono`,children:`mate companion update`}),`; this stage is not complete.`]}):null]}),e.kind===`skill`&&t?(0,U.jsx)(y,{title:`Steps`,aside:e.source,children:(0,U.jsx)(`ol`,{className:`workflow-stage-steps m-0 grid list-decimal gap-1 pl-5 text-sm`,children:e.steps.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsx)(`code`,{className:`font-mono`,children:e.skill})},`${t}-${e.skill}`))})}):null,(0,U.jsx)(y,{title:`What`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm leading-relaxed`,children:e.what})}),(0,U.jsx)(y,{title:`Why`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm leading-relaxed`,children:e.why})}),n.length>0?(0,U.jsx)(y,{title:`Changes at this stage`,aside:String(n.length),children:(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:n.map(e=>(0,U.jsx)(`li`,{className:`truncate font-mono text-sm`,children:e},e))})}):null]})}function ie({step:e}){return e.kind===`human`?(0,U.jsxs)(`p`,{className:`workflow-card-human m-0 text-sm`,children:[`Review `,e.artifact,` yourself — no skill, no prompt`]}):e.alternatives?.length?(0,U.jsx)(`div`,{className:`workflow-option-list grid gap-3`,children:e.alternatives.map(e=>(0,U.jsxs)(`div`,{className:`workflow-option grid gap-1.5`,children:[(0,U.jsx)(t,{text:e.prompt,copy:e.copyPrompt,label:`${e.name} prompt`}),(0,U.jsx)(`small`,{className:`text-xs text-muted`,children:e.description})]},e.name))}):e.prompt?(0,U.jsx)(t,{text:e.prompt,copy:e.copyPrompt??e.prompt,label:`${e.label} prompt`}):null}var ae=m();function oe(e,t){let n=e.map(e=>({name:e.name,stage:u(e,t).stageId})),r=s(t).map(e=>({node:e.kind===`review`?ee(e.id):e.id,label:e.label,changes:n.flatMap(t=>t.stage===e.id?[t.name]:[])})),i={};for(let e of r)e.changes.length>0&&(i[e.node]=e.changes.length);return{counts:i,byStage:r}}var se=[];function ce({payload:e,changes:t=se}){let{counts:n,byStage:r}=oe(t,e.workflow??ae);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(h,{warnings:e.warnings}),(0,U.jsx)(`div`,{className:`workflow-view`,children:(0,U.jsx)(K,{payload:e,counts:n,changesByStage:r})})]})}var le=function(){let e=l.useSearch(),t=d(),n=o({...f(`dashboard`,e),enabled:t});return(0,U.jsx)(p,{view:`workflow`,search:e,children:e=>(0,U.jsx)(ce,{payload:{skills:e.skills??[],topology:e.topology??null,warnings:e.warnings,workflow:e.workflow},changes:c(n.data?.changes??[],n.data?.submitted??[])})})};export{le as component};
|