@uniqbit/mate-core 1.0.0-canary.7 → 1.0.0-canary.9
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 +33 -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/create-mate.ts +4 -1
- 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/mcp-manager/resolve.ts +70 -0
- package/src/lib/mcp-manager/store.ts +109 -0
- package/src/lib/mcp-manager/types.ts +58 -0
- package/src/lib/mcp-manager/validate.ts +246 -0
- package/src/lib/openspec-cli.ts +10 -5
- package/src/lib/orchestrator/config-store.ts +30 -7
- package/src/lib/orchestrator/engine-floor.ts +16 -4
- package/src/lib/orchestrator/engine-guard.ts +7 -1
- package/src/lib/orchestrator/types.ts +4 -0
- 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/runtime/workflow/turn.ts +14 -12
- package/src/studio.ts +23 -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/mcp-manager.ts +74 -0
- package/src/tools/setup/capabilities/rtk.ts +27 -86
- package/src/tools/setup/capabilities/tokensave.ts +76 -54
- package/src/tools/setup/context-services.ts +35 -6
- package/src/tools/setup/dynamic-plugins/audiences.ts +31 -16
- 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/engine.ts +55 -3
- package/src/tools/setup/mate.ts +26 -1
- package/src/tools/setup/plugin.ts +14 -0
- package/src/tools/setup/plugins/gitignore.ts +45 -12
- package/src/tools/setup/providers/claude-format.ts +39 -2
- package/src/tools/setup/providers/claude.ts +10 -0
- package/src/tools/setup/providers/opencode-format.ts +13 -3
- 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-C9SQW3kI.js +1 -0
- package/studio-dist/client/assets/cn-DC80MJV0.js +1 -0
- package/studio-dist/client/assets/combobox-D7mKYCBb.js +1 -0
- package/studio-dist/client/assets/{companion-view-DINdPF-b.js → companion-view-C1F0_jbt.js} +1 -1
- package/studio-dist/client/assets/fields-CEep8IFT.js +1 -0
- package/studio-dist/client/assets/friction-D9dBU7WN.js +1 -0
- package/studio-dist/client/assets/getting-started-BDyGvHhc.js +1 -0
- package/studio-dist/client/assets/{getting-started-djaQeWlu.js → getting-started-BN4aTpsz.js} +1 -1
- package/studio-dist/client/assets/getting-started._topic-B9ajbF4o.js +1 -0
- package/studio-dist/client/assets/getting-started.index-CYiBPtb7.js +1 -0
- package/studio-dist/client/assets/graph-ah7ZXfTa.js +2 -0
- package/studio-dist/client/assets/{graph-canvas-DIcAqwtK.js → graph-canvas-Be5qgdDt.js} +1 -1
- package/studio-dist/client/assets/guides-CsL0660B.js +1 -0
- package/studio-dist/client/assets/index-zmRH87D4.js +40 -0
- package/studio-dist/client/assets/{markdown-view-jMiaBTSO.js → markdown-view-dku7MGPn.js} +1 -1
- package/studio-dist/client/assets/panel-COgk0vP5.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-Cn3WBHab.js +1 -0
- package/studio-dist/client/assets/{prepaint-CKsXyJOR.js → prepaint-BkoDSw5X.js} +1 -1
- package/studio-dist/client/assets/{queries-Dfp5deWj.js → queries-CMvC2OkU.js} +1 -1
- package/studio-dist/client/assets/reports-C_AqLBYH.js +1 -0
- package/studio-dist/client/assets/routes-BokQmHtC.js +1 -0
- package/studio-dist/client/assets/{search-CXosfvYh.js → search-DxidNK2M.js} +1 -1
- package/studio-dist/client/assets/select-CYFCbHUd.js +1 -0
- package/studio-dist/client/assets/skills-R3vttWHM.js +1 -0
- package/studio-dist/client/assets/{specs-Dl8HfGlU.js → specs-Bqd1ajyD.js} +1 -1
- package/studio-dist/client/assets/specs-view-znqFPx9p.js +1 -0
- package/studio-dist/client/assets/{steps-CKUno4lh.js → steps-tVDWn7j6.js} +1 -1
- package/studio-dist/client/assets/{store-DyXbi6o9.js → store-BYnEU33C.js} +1 -1
- package/studio-dist/client/assets/studio-ndtFcS2Y.js +100 -0
- package/studio-dist/client/assets/{studio-queries-BflKt9va.js → studio-queries-CkUSByy7.js} +1 -1
- package/studio-dist/client/assets/{usage-Blcl8kA_.js → usage-Kuhr8dSl.js} +13 -13
- package/studio-dist/client/assets/{useAnchoredPopupScrollLock-BBXJpX5L.js → useAnchoredPopupScrollLock-dc_kP4Go.js} +1 -1
- package/studio-dist/client/assets/useMutation-CqtM9COw.js +1 -0
- package/studio-dist/client/assets/vault-CSP8kwRg.js +1 -0
- package/studio-dist/client/assets/warnings-Cnw99ugO.js +1 -0
- package/studio-dist/client/assets/workflow-BPJAmmZi.js +1 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-JoHQ5ihx.js → __23tanstack-start-server-fn-resolver-CS3QRY4Q.js} +18 -18
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +58 -58
- package/studio-dist/server/assets/{button-B7e1fRyW.js → button-Ct_WeYLc.js} +3 -3480
- package/studio-dist/server/assets/cn-DWFJaP_9.js +5528 -0
- package/studio-dist/server/assets/{combobox--S_OmUfh.js → combobox-17vO5Uz8.js} +6 -5
- package/studio-dist/server/assets/{companion-view-D-vGM55e.js → companion-view-JkxnGLlp.js} +2 -2
- package/studio-dist/server/assets/{companions-Dr6IpNAb.js → companions-YNLsbnch.js} +1 -1
- package/studio-dist/server/assets/{fields-B4qM2ZwC.js → fields-VytPpqBq.js} +2 -1
- package/studio-dist/server/assets/{friction-sLxaWY-H.js → friction-B6osqFSm.js} +56 -16
- package/studio-dist/server/assets/{friction-CWOTjpCV.js → friction-BW86PCPM.js} +2 -2
- package/studio-dist/server/assets/{getting-started-Cq5Pcnsr.js → getting-started-CFHSeX5h.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-CmWdl3u3.js → getting-started._topic-BK2eU6AS.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-AB8xpTFY.js → getting-started.index-DZLuXnNO.js} +2 -2
- package/studio-dist/server/assets/{graph-C_Hn-Wf_.js → graph-BJVZBevL.js} +8 -7
- package/studio-dist/server/assets/{graph-B11ITte0.js → graph-DGZHV-Ek.js} +1 -1
- package/studio-dist/server/assets/{graph-canvas-BthrSmPS.js → graph-canvas-lrNT6jbl.js} +2 -2
- package/studio-dist/server/assets/{guides-B8HdeK_C.js → guides-CEwLOZb9.js} +1 -1
- package/studio-dist/server/assets/{guides-BVQ4pt5B.js → guides-_G8Vucsk.js} +1 -1
- package/studio-dist/server/assets/{guides.server-DqFQAStf.js → guides.server-ZWFKX2XJ.js} +1 -1
- package/studio-dist/server/assets/{markdown-view-rwiiVcPC.js → markdown-view-Bmjghg_Z.js} +1 -1
- package/studio-dist/server/assets/{panel-CUxRIpYL.js → panel-DvRjyil3.js} +4 -3
- package/studio-dist/server/assets/{plugins._service._view-BSvGnlhU.js → plugins._service._view-B32LzraG.js} +8 -5
- package/studio-dist/server/assets/{prepaint-B28ClcPN.js → prepaint-BEHwKl51.js} +1 -1
- package/studio-dist/server/assets/{queries-S_Pl90IG.js → queries-D6Vq0AuZ.js} +1 -1
- package/studio-dist/server/assets/{reports-B9k98oE6.js → reports-DDaH5k0H.js} +1 -1
- package/studio-dist/server/assets/{reports-CJpAItPk.js → reports-Dn92pLap.js} +7 -6
- package/studio-dist/server/assets/{router-DF0etoNa.js → router-Bjf4S9tO.js} +57 -32
- package/studio-dist/server/assets/{routes-6ylCLkyg.js → routes-B4sNiE0X.js} +8 -7
- package/studio-dist/server/assets/{search-b-yQesv3.js → search-DKeJRvg8.js} +1 -1
- package/studio-dist/server/assets/{select-CjuKScan.js → select-CVHYL7oR.js} +5 -4
- package/studio-dist/server/assets/{shell-DLkP7wG9.js → shell-BxbYYaAk.js} +4 -3
- package/studio-dist/server/assets/{skills-zeU80A9S.js → skills-B4-0qpqN.js} +8 -7
- package/studio-dist/server/assets/{skills-DGg0mWDM.js → skills-Bj8eOgzR.js} +1 -1
- package/studio-dist/server/assets/{specs-DDBNT_v1.js → specs-rfMug6qW.js} +4 -4
- package/studio-dist/server/assets/{specs-view-exvmWdg0.js → specs-view-qi1SE1Sl.js} +10 -9
- package/studio-dist/server/assets/{steps-D1tYAyWZ.js → steps-rger6HJc.js} +1 -1
- package/studio-dist/server/assets/{store-kS7zk0Hr.js → store-Dg9T7oWs.js} +1 -1
- package/studio-dist/server/assets/{studio-qRvQjRpz.js → studio-D79JzDLc.js} +1347 -0
- package/studio-dist/server/assets/{studio-queries-qOXOYoPt.js → studio-queries-CeFfmIuM.js} +3 -3
- package/studio-dist/server/assets/{usage-C2um7YiV.js → usage-BJgYWRCX.js} +10 -10
- package/studio-dist/server/assets/{usage-Cwle9-xY.js → usage-Dw_UQFX-.js} +1 -1
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-kQBB3y_b.js → useAnchoredPopupScrollLock-ciS_sEq3.js} +2 -2
- package/studio-dist/server/assets/{useMutation-C-WO6hCM.js → useMutation-DnWK0PhO.js} +2 -2
- package/studio-dist/server/assets/{vault-CEBBRLMb.js → vault-BzarssiL.js} +1 -1
- package/studio-dist/server/assets/{vault-B8vgVIH9.js → vault-CvlrLd2H.js} +6 -6
- package/studio-dist/server/assets/{views-UgO0Qz_g.js → views-CAxwKHMK.js} +2 -2
- package/studio-dist/server/assets/{warnings-BxK4VfV5.js → warnings-BpVCugHm.js} +2 -1
- package/studio-dist/server/assets/{workflow-BrTK632u.js → workflow-BdrzcCt8.js} +9 -8
- 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/getting-started._topic-DVB8e5R9.js +0 -1
- package/studio-dist/client/assets/getting-started.index-DQvLHEr1.js +0 -1
- package/studio-dist/client/assets/graph-DbNnR884.js +0 -2
- package/studio-dist/client/assets/guides-D6T6W_jV.js +0 -1
- 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/studio-0ueISxwP.js +0 -100
- 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,100 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./jsx-runtime-MZURdZre.js";e(((e,t)=>{t.exports={}}))();var t=[`engineering`,`analysis`],n={engineering:[`dashboard`,`workflow`,`skills`,`getting-started`],analysis:[`dashboard`]},r=[`vault`,`specs`,`reports`,`graph`,`usage`,`friction`];function i(e){return[...n[e],...r]}var a={standard:Object.freeze({profile:`standard`,enabled:Object.freeze([`engineering`,`analysis`]),defaultMode:`engineering`}),appliance:Object.freeze({profile:`appliance`,enabled:Object.freeze([`analysis`]),defaultMode:`analysis`})};function o(e=`standard`){return a[e]}o(`standard`);var s={"product-engineer":`engineering`,"business-analyst":`analysis`},c=`companion`,l=`studioMode`,u=`role`,d=`<change-name>`,f=`<idea>`,p=RegExp(`^[0-9a-f]{10}$`);function m(e){let n=e.get(l);if(n!==null)return t.includes(n)?n:null;let r=e.get(`role`)??``;return Object.hasOwn(s,r)?s[r]:null}function h(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var g=h();function _(e){g=e}var v={exec:()=>null};function y(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function b(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(S.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var x=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),S={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:y(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:y(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:y(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:y(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:y(e=>RegExp(`^ {0,${e}}(?:</?(?:${w})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:y(e=>RegExp(`^ {0,${e}}>`))},ee=/^(?:[ \t]*(?:\n|$))+/,te=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ne=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,C=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,re=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ie=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ae=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,oe=b(ae).replace(/bull/g,ie).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),se=b(ae).replace(/bull/g,ie).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ce=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,le=/^[^\n]+/,ue=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,de=b(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,ue).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),fe=b(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ie).getRegex(),w=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,pe=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,me=b(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,pe).replace(`tag`,w).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),he=e=>b(ce).replace(`hr`,C).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,w).getRegex(),ge=he(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),_e=he(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ve={blockquote:b(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,_e).getRegex(),code:te,def:de,fences:ne,heading:re,hr:C,html:me,lheading:oe,list:fe,newline:ee,paragraph:ge,table:v,text:le},ye=b(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,C).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,w).getRegex(),be={...ve,lheading:se,table:ye,paragraph:b(ce).replace(`hr`,C).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ye).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,w).getRegex()},xe={...ve,html:b(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,pe).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:v,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:b(ce).replace(`hr`,C).replace(`heading`,` *#{1,6} *[^
|
|
2
|
-
]`).replace(`lheading`,oe).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Se=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ce=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,we=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Te=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,E=/[\s\p{P}\p{S}]/u,Ee=/[^\s\p{P}\p{S}]/u,De=b(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,E).getRegex(),Oe=/[\p{Pi}\p{Ps}"']/u,ke=/(?!~)[\p{P}\p{S}]/u,Ae=/(?!~)[\s\p{P}\p{S}]/u,je=/(?:[^\s\p{P}\p{S}]|~)/u,Me=b(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,x?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Ne=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Pe=b(Ne,`u`).replace(/punct/g,T).getRegex(),Fe=b(Ne,`u`).replace(/punct/g,ke).getRegex(),Ie=b(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Oe).replace(/punct/g,T).getRegex(),Le=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Re=b(Le,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),ze=b(Le,`gu`).replace(/notPunctSpace/g,je).replace(/punctSpace/g,Ae).replace(/punct/g,ke).getRegex(),Be=b(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Ve=b(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),He=b(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Ue=b(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,T).getRegex(),We=b(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Ge=b(/\\(punct)/,`gu`).replace(/punct/g,T).getRegex(),Ke=b(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,T).getRegex(),qe=b(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Je=b(pe).replace(`(?:-->|$)`,`-->`).getRegex(),Ye=b(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Je).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Xe=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Ze=b(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Xe).getRegex(),Qe=b(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,Ze).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$e=b(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ze).replace(`ref`,ue).getRegex(),et=b(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,ue).getRegex(),tt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,nt=b(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Xe).getRegex(),rt=b(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,b(/^!?\[(label)\]\[(ref)\]/).replace(`label`,nt).replace(`ref`,tt).getRegex()).replace(`nolink`,b(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,tt).getRegex()).getRegex(),it=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,at=b(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),ot={_backpedal:v,anyPunctuation:Ge,anyPunctuationOutsideCode:Ke,autolink:qe,blockSkip:Me,br:we,code:Ce,del:v,delLDelim:v,delRDelim:v,emStrongLDelim:Pe,emStrongRDelimAst:Re,emStrongRDelimUnd:Ve,escape:Se,link:Qe,nolink:et,punctuation:De,reflink:$e,reflinkSearch:rt,tag:Ye,text:Te,url:v},st={...ot,emStrongLDelim:Ie,emStrongRDelimAst:Be,emStrongRDelimUnd:He,link:b(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Ze).getRegex(),reflink:b(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Ze).getRegex()},ct={...ot,emStrongRDelimAst:ze,emStrongLDelim:Fe,delLDelim:Ue,delRDelim:We,url:b(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,at).replace(`protocol`,it).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:b(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,it).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},lt={...ct,br:b(we).replace(`{2,}`,`*`).getRegex(),text:b(ct.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},ut={normal:ve,gfm:be,pedantic:xe},dt={normal:ot,gfm:ct,breaks:lt,pedantic:st},ft={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},pt=e=>ft[e];function D(e,t){if(t){if(S.escapeTest.test(e))return e.replace(S.escapeReplace,pt)}else if(S.escapeTestNoEncode.test(e))return e.replace(S.escapeReplaceNoEncode,pt);return e}function mt(e){return S.numericCharacterReference.test(e)?e.replace(S.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function ht(e){try{e=encodeURI(e).replace(S.percentDecode,`%`)}catch{return null}return e}function gt(e,t){let n=e.replace(S.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(S.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(S.slashPipe,`|`);return n}function O(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function _t(e){let t=e.split(`
|
|
3
|
-
`),n=t.length-1;for(;n>=0&&S.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
4
|
-
`)}function vt(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function yt(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function bt(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function xt(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function St(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
5
|
-
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
6
|
-
`)}function Ct(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var wt=class{options;rules;lexer;constructor(e){this.options=e||g}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:_t(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=St(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=O(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:O(t[0],`
|
|
7
|
-
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:O(t[0],`
|
|
8
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=O(t[0],`
|
|
9
|
-
`).split(`
|
|
10
|
-
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
11
|
-
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
12
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
13
|
-
${s}`:s,r=r?`${r}
|
|
14
|
-
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
15
|
-
`),o=t.raw+`
|
|
16
|
-
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
17
|
-
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
|
|
18
|
-
${d.join(`
|
|
19
|
-
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
20
|
-
`+e.join(`
|
|
21
|
-
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
22
|
-
`)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
|
|
23
|
-
`,1)[0],d=t[1].length,f=this.options.pedantic?bt(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>bt(e,d)),p=e.split(`
|
|
24
|
-
`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
|
|
25
|
-
`,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>bt(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
|
|
26
|
-
`+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;a+=`
|
|
27
|
-
`+p}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=_t(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&yt(t[2],`()`)!==-1)return;let e=vt(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:O(t[0],`
|
|
28
|
-
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=gt(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
29
|
-
`):[],a={type:`table`,raw:O(t[0],`
|
|
30
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(gt(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:O(t[0],`
|
|
31
|
-
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
32
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Ct(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=O(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=yt(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),xt(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Ct(e,n[1],r,this.rules))return;let i=t[vt((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return xt(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:mt(t[0]),escaped:e}}}},k=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||g,this.options.tokenizer=this.options.tokenizer||new wt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:S,block:ut.normal,inline:dt.normal};this.options.pedantic?(t.block=ut.pedantic,t.inline=dt.pedantic):this.options.gfm&&(t.block=ut.gfm,t.inline=this.options.breaks?dt.breaks:dt.gfm),this.tokenizer.rules=t}static get rules(){return{block:ut,inline:dt}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(S.carriageReturn,`
|
|
33
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(S.tabCharGlobal,` `).replace(S.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
34
|
-
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
35
|
-
`)?``:`
|
|
36
|
-
`)+i.raw,n.text+=`
|
|
37
|
-
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
38
|
-
`)?``:`
|
|
39
|
-
`)+i.raw,n.text+=`
|
|
40
|
-
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
41
|
-
`)?``:`
|
|
42
|
-
`)+i.raw,r.text+=`
|
|
43
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
44
|
-
`)?``:`
|
|
45
|
-
`)+i.raw,n.text+=`
|
|
46
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,vt(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,vt(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Tt=class{options;parser;constructor(e){this.options=e||g}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(S.notSpaceStart)?.[0],i=e?e.replace(S.endingNewline,``)+`
|
|
47
|
-
`:``;return r?`<pre><code class="language-`+D(r)+`">`+(n?i:D(i,!0))+`</code></pre>
|
|
48
|
-
`:`<pre><code>`+(n?i:D(i,!0))+`</code></pre>
|
|
49
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
50
|
-
${this.parser.parse(e)}</blockquote>
|
|
51
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
52
|
-
`}hr(e){return`<hr>
|
|
53
|
-
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
54
|
-
`+r+`</`+i+`>
|
|
55
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
56
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
57
|
-
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
58
|
-
<thead>
|
|
59
|
-
`+t+`</thead>
|
|
60
|
-
`+r+`</table>
|
|
61
|
-
`}tablerow({text:e}){return`<tr>
|
|
62
|
-
${e}</tr>
|
|
63
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
64
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${D(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?D(n,!0):this.parser.parseInline(r),o=ht(e);if(o===null)return a;e=D(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+D(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=ht(e);if(i===null)return D(n);e=i;let a=`<img src="${D(e)}" alt="${D(n)}"`;return t&&(a+=` title="${D(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:D(e.text)}},Et=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},A=class e{options;renderer;textRenderer;constructor(e){this.options=e||g,this.options.renderer=this.options.renderer||new Tt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Et}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},j=class{options;block;constructor(e){this.options=e||g}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?k.lex:k.lexInline}provideParser(e=this.block){return e?A.parse:A.parseInline}};function M(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var N=new class{defaults=h();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=A;Renderer=Tt;TextRenderer=Et;Lexer=k;Tokenizer=wt;Hooks=j;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(M(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)M(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)M(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;M(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);M(n,this.walkTokens(i,t))}):e.tokens&&M(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Tt(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new wt(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new j;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=j.passThroughHooks.has(n)?e=>{if(this.defaults.async&&j.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&M(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return k.lex(e,t??this.defaults)}parser(e,t){return A.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?k.lex:k.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?A.parse:A.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?k.lex:k.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?A.parse:A.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
65
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+D(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function P(e,t){return N.parse(e,t)}P.options=P.setOptions=function(e){return N.setOptions(e),P.defaults=N.defaults,_(P.defaults),P},P.getDefaults=h,P.defaults=g;function Dt(...e){return N.use(...e),P.defaults=N.defaults,_(P.defaults),P}P.use=Dt,P.walkTokens=function(e,t){return N.walkTokens(e,t)},P.parseInline=N.parseInline,P.Parser=A,P.parser=A.parse,P.Renderer=Tt,P.TextRenderer=Et,P.Lexer=k,P.lexer=k.lex,P.Tokenizer=wt,P.Hooks=j,P.parse=P,P.options,P.setOptions,P.walkTokens,P.parseInline,A.parse,k.lex;var Ot=Symbol.for(`yaml.alias`),kt=Symbol.for(`yaml.document`),F=Symbol.for(`yaml.map`),At=Symbol.for(`yaml.pair`),jt=Symbol.for(`yaml.scalar`),Mt=Symbol.for(`yaml.seq`),I=Symbol.for(`yaml.node.type`),L=e=>!!e&&typeof e==`object`&&e[I]===Ot,Nt=e=>!!e&&typeof e==`object`&&e[I]===kt,Pt=e=>!!e&&typeof e==`object`&&e[I]===F,R=e=>!!e&&typeof e==`object`&&e[I]===At,z=e=>!!e&&typeof e==`object`&&e[I]===jt,Ft=e=>!!e&&typeof e==`object`&&e[I]===Mt;function B(e){if(e&&typeof e==`object`)switch(e[I]){case F:case Mt:return!0}return!1}function V(e){if(e&&typeof e==`object`)switch(e[I]){case Ot:case F:case jt:case Mt:return!0}return!1}var It=e=>(z(e)||B(e))&&!!e.anchor,H=Symbol(`break visit`),Lt=Symbol(`skip children`),U=Symbol(`remove node`);function Rt(e,t){let n=zt(t);Nt(e)?W(null,e.contents,n,Object.freeze([e]))===U&&(e.contents=null):W(null,e,n,Object.freeze([]))}Rt.BREAK=H,Rt.SKIP=Lt,Rt.REMOVE=U;function W(e,t,n,r){let i=Bt(e,t,n,r);if(V(i)||R(i))return Vt(e,r,i),W(e,i,n,r);if(typeof i!=`symbol`){if(B(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=W(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===H)return H;else i===U&&(t.items.splice(e,1),--e)}}else if(R(t)){r=Object.freeze(r.concat(t));let e=W(`key`,t.key,n,r);if(e===H)return H;e===U&&(t.key=null);let i=W(`value`,t.value,n,r);if(i===H)return H;i===U&&(t.value=null)}}return i}function zt(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Bt(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Pt(t))return n.Map?.(e,t,r);if(Ft(t))return n.Seq?.(e,t,r);if(R(t))return n.Pair?.(e,t,r);if(z(t))return n.Scalar?.(e,t,r);if(L(t))return n.Alias?.(e,t,r)}function Vt(e,t,n){let r=t[t.length-1];if(B(r))r.items[e]=n;else if(R(r))e===`key`?r.key=n:r.value=n;else if(Nt(r))r.contents=n;else{let e=L(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function Ht(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Ut(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Ut(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Ut(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Ut(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Ut(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function G(e,t,n){if(Array.isArray(e))return e.map((e,t)=>G(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!It(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Wt=class{constructor(e){Object.defineProperty(this,I,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Nt(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=G(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Ut(i,{"":o},``,o):o}},Gt=class extends Wt{constructor(e){super(Ot),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Rt(e,{Node:(e,t)=>{(L(t)||It(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(G(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Kt(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Ht(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Kt(e,t,n){if(L(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(B(t)){let r=0;for(let i of t.items){let t=Kt(e,i,n);t>r&&(r=t)}return r}if(R(t)){let r=Kt(e,t.key,n),i=Kt(e,t.value,n);return Math.max(r,i)}return 1}var qt=e=>!e||typeof e!=`function`&&typeof e!=`object`,K=class extends Wt{constructor(e){super(jt),this.value=e}toJSON(e,t){return t?.keep?this.value:G(this.value,e,t)}toString(){return String(this.value)}};K.BLOCK_FOLDED=`BLOCK_FOLDED`,K.BLOCK_LITERAL=`BLOCK_LITERAL`,K.PLAIN=`PLAIN`,K.QUOTE_DOUBLE=`QUOTE_DOUBLE`,K.QUOTE_SINGLE=`QUOTE_SINGLE`;var Jt=`tag:yaml.org,2002:`;function Yt(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Xt(e,t,n){if(Nt(e)&&(e=e.contents),V(e))return e;if(R(e)){let t=n.schema[F].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new Gt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Jt+t.slice(2));let l=Yt(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new K(e);return c&&(c.node=t),t}l=e instanceof Map?o[F]:Symbol.iterator in Object(e)?o[Mt]:o[F]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new K(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Zt(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Xt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Qt=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,$t=class extends Wt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>V(t)||R(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Qt(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(B(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Zt(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(B(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&z(i)?i.value:i:B(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!R(t))return!1;let n=t.value;return n==null||e&&z(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return B(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(B(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Zt(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},en=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function tn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var q=(e,t,n)=>e.endsWith(`
|
|
66
|
-
`)?tn(n,t):n.includes(`
|
|
67
|
-
`)?`
|
|
68
|
-
`+tn(n,t):(e.endsWith(` `)?``:` `)+n,nn=`flow`,rn=`block`,an=`quoted`;function on(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=sn(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
69
|
-
`)n===`block`&&(h=sn(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
70
|
-
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
71
|
-
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function sn(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
72
|
-
`);r=t,i=t+1,a=e[i]}return r}var cn=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),ln=e=>/^(%|---|\.\.\.)/m.test(e);function un(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
73
|
-
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function dn(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(ln(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
74
|
-
|
|
75
|
-
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
76
|
-
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:on(o,a,an,cn(t,!1))}function fn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
77
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return dn(e,t);let n=t.indent||(ln(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:on(r,n,nn,cn(t,!1))}function J(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=dn;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?fn:i&&!t?dn:n?fn:dn}return r(e,t)}var pn;try{pn=RegExp(`(^|(?<!
|
|
78
|
-
))
|
|
79
|
-
+(?!
|
|
80
|
-
|$)`,`g`)}catch{pn=/\n+(?!\n|$)/g}function mn({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return J(n,r);let l=r.indent||(r.forceBlockIndent||ln(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===K.BLOCK_FOLDED?!1:t===K.BLOCK_LITERAL||!un(n,c,l.length);if(!n)return u?`|
|
|
81
|
-
`:`>
|
|
82
|
-
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
83
|
-
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
84
|
-
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
85
|
-
`&&(p=p.slice(0,-1)),p.replace(pn,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
86
|
-
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
87
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=cn(r,!0);o!==`folded`&&t!==K.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=on(`${v}${e}${p}`,l,rn,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function hn(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
88
|
-
`)||u&&/[[\]{},]/.test(a))return J(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
89
|
-
`)?J(a,t):mn(e,t,n,r);if(!s&&!u&&i!==K.PLAIN&&a.includes(`
|
|
90
|
-
`))return mn(e,t,n,r);if(ln(a)){if(c===``)return t.forceBlockIndent=!0,mn(e,t,n,r);if(s&&c===l)return J(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return J(a,t)}return s?d:on(d,c,nn,cn(t,!1))}function gn(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==K.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=K.QUOTE_DOUBLE);let c=e=>{switch(e){case K.BLOCK_FOLDED:case K.BLOCK_LITERAL:return i||a?J(o.value,t):mn(o,t,n,r);case K.QUOTE_DOUBLE:return dn(o.value,t);case K.QUOTE_SINGLE:return fn(o.value,t);case K.PLAIN:return hn(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function _n(e,t){let n=Object.assign({blockQuote:!0,commentString:en,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function vn(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(z(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function yn(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(z(e)||B(e))&&e.anchor;a&&Ht(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function bn(e,t,n,r){if(R(e))return e.toString(t,n,r);if(L(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=V(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=vn(t.doc.schema.tags,a);let o=yn(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):z(a)?gn(a,t,n,r):a.toString(t,n,r);return o?z(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function xn({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=V(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(B(e)||!V(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||B(e)||(z(e)?e.type===K.BLOCK_FOLDED||e.type===K.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=bn(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=q(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=q(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=q(g,n.indent,l(f))));let _,v,y;V(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&z(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Ft(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=bn(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
|
91
|
-
`:``,v){let e=l(v);S+=`\n${tn(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
|
92
|
-
`&&y&&(S=`
|
|
93
|
-
|
|
94
|
-
`):S+=`\n${n.indent}`}else if(!p&&B(t)){let e=x[0],r=x.indexOf(`
|
|
95
|
-
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
|
|
96
|
-
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=q(g,n.indent,l(y)):h&&i&&i(),g}function Sn(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Cn=`<<`,wn={identify:e=>e===Cn||typeof e==`symbol`&&e.description===Cn,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new K(Symbol(Cn)),{addToJSMap:En}),stringify:()=>Cn},Tn=(e,t)=>(wn.identify(t)||z(t)&&(!t.type||t.type===K.PLAIN)&&wn.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===wn.tag&&e.default);function En(e,t,n){let r=On(e,n);if(Ft(r))for(let n of r.items)Dn(e,t,n);else if(Array.isArray(r))for(let n of r)Dn(e,t,n);else Dn(e,t,r)}function Dn(e,t,n){let r=On(e,n);if(!Pt(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function On(e,t){return e&&L(t)?t.resolve(e.doc,e):t}function kn(e,t,{key:n,value:r}){if(V(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Tn(e,n))En(e,t,r);else{let i=G(n,``,e);if(t instanceof Map)t.set(i,G(r,i,e));else if(t instanceof Set)t.add(i);else{let a=An(n,i,e),o=G(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function An(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(V(e)&&n?.doc){let t=_n(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Sn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function jn(e,t,n){return new Y(Xt(e,void 0,n),Xt(t,void 0,n))}var Y=class e{constructor(e,t=null){Object.defineProperty(this,I,{value:At}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return V(n)&&(n=n.clone(t)),V(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return kn(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?xn(this,e,t,n):JSON.stringify(this)}};function Mn(e,t,n){return(t.inFlow??e.flow?Pn:Nn)(e,t,n)}function Nn({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(V(i))!d&&i.spaceBefore&&f.push(``),Fn(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(R(i)){let e=V(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Fn(n,f,e.commentBefore,d))}d=!1;let s=bn(i,u,()=>o=null,()=>d=!0);o&&(s+=q(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
97
|
-
`}}return e?(p+=`
|
|
98
|
-
`+tn(l(e),c),s&&s()):d&&o&&o(),p}function Pn({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(V(i))i.spaceBefore&&d.push(``),Fn(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(R(i)){let e=V(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Fn(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=V(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=bn(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
99
|
-
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=q(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
100
|
-
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Fn({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=tn(t(r),e);n.push(i.trimStart())}}function X(e,t){let n=z(t)?t.value:t;for(let r of e)if(R(r)&&(r.key===t||r.key===n||z(r.key)&&r.key.value===n))return r}var Z=class extends $t{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(F,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(jn(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=R(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Y(e,e?.value):new Y(e.key,e.value);let r=X(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);z(r.value)&&qt(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=X(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=X(this.items,e)?.value;return(!t&&z(n)?n.value:n)??void 0}has(e){return!!X(this.items,e)}set(e,t){this.add(new Y(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)kn(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!R(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Mn(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},In={collection:`map`,default:!0,nodeClass:Z,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Pt(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Z.from(e,t,n)},Ln=class extends $t{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Mt,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Rn(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Rn(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&z(r)?r.value:r}has(e){let t=Rn(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Rn(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];z(r)&&qt(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(G(e,String(r++),t));return n}toString(e,t,n){return e?Mn(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Xt(a,void 0,n))}}return i}};function Rn(e){let t=z(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var zn={collection:`seq`,default:!0,nodeClass:Ln,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Ft(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Ln.from(e,t,n)};function Bn(e){return typeof e==`bigint`||Number.isInteger(e)}var Vn=({value:e})=>JSON.stringify(e),Hn=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Vn},{identify:e=>e==null,createNode:()=>new K(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Vn},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Vn},{identify:Bn,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Bn(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Vn}];[In,zn].concat(Hn,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Un(e,t,n){let{replacer:r}=n,i=new Ln(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(jn(o,s,n))}return i}var Wn=class e extends Ln{constructor(){super(),this.add=Z.prototype.add.bind(this),this.delete=Z.prototype.delete.bind(this),this.get=Z.prototype.get.bind(this),this.has=Z.prototype.has.bind(this),this.set=Z.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(R(e)?(r=G(e.key,``,t),i=G(e.value,r,t)):r=G(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Un(e,t,n),i=new this;return i.items=r.items,i}};Wn.tag=`tag:yaml.org,2002:omap`;var Gn=class e extends Z{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=R(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Y(e.key,null):new Y(e,null),X(this.items,t.key)||this.items.push(t)}get(e,t){let n=X(this.items,e);return!t&&R(n)?z(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=X(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Y(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(jn(e,null,n));return i}};Gn.tag=`tag:yaml.org,2002:set`;var Kn=Symbol(`break visit`),qn=Symbol(`skip children`),Jn=Symbol(`remove item`);function Q(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Yn(Object.freeze([]),e,t)}Q.BREAK=Kn,Q.SKIP=qn,Q.REMOVE=Jn,Q.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Q.parentCollection=(e,t)=>{let n=Q.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Yn(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Yn(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Kn)return Kn;else r===Jn&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}var Xn=[`bug`,`unclear`,`missing`],Zn=[`command`,`hook`,`skill`,`guidance`,`capability`,`docs`],Qn=[`fixed`,`reported`,`dismissed`];[...Qn];var $n=[`open`,`handled`,`all`];function er(e,t){let n=new Set([...e.groups.map(e=>e.subjectType),...e.freeReports.map(e=>e.subjectType)]),r=Zn.filter(e=>n.has(e)),i=r.find(e=>e===t.type),a=e=>(t.state===`all`||e.open===(t.state===`open`))&&(!i||e.subjectType===i),o=e.groups.filter(a),s=e.freeReports.filter(e=>a(e)&&(!t.kind||e.kind===t.kind));return{groups:o,freeReports:s,hidden:e.groups.length+e.freeReports.length-o.length-s.length,types:r,type:i}}var tr=`.mate/config/workflow.yaml`,nr=`openspec`,$=(e,t,n,r,i)=>({id:e,label:t,skill:n,optional:r,...i?{milestone:i}:{}}),rr=[$(`clarify-intent`,`Clarify intent`,`mate-clarify-intent`,!0),$(`explore`,`Explore change`,`mate-explore-change`,!1,`exists`),$(`propose`,`Propose change`,`mate-propose-change`,!1,`planned`),$(`apply`,`Apply change`,`mate-apply-change`,!1,`implemented`),$(`inspect-outcome`,`Inspect outcome`,`mate-show-me`,!0),$(`refine-code`,`Refine code`,`mate-simplify-code`,!0),$(`submit`,`Submit change`,`mate-submit-change`,!1,`submitted`),$(`publish`,`Publish companion artifacts`,`mate-publish-artifact`,!1,`published`)],ir=`review`,ar=`propose`,or=new Map(rr.map(e=>[e.id,e]));new Map(rr.map(e=>[e.skill,e]));function sr(e,t,n,r,i){let a=or.get(e),o=r.map(e=>e===a?.skill?{skill:e,own:!0}:{skill:e}),s=a?.milestone;return{id:e,label:t,kind:`skill`,optional:n,source:i,steps:o,entry:r[0]??``,...s?{milestone:s}:{}}}function cr(){return rr.flatMap(e=>{let t=sr(e.id,e.label,e.optional,[e.skill],`default`);return e.id===ar?[t,{id:ir,label:`Human review`,kind:`review`,optional:!1,source:`default`,review:`schema`}]:[t]})}function lr(){return{file:null,stages:cr(),artifacts:[],submitArtifact:nr,warnings:[]}}function ur(e){return e.artifacts.find(t=>t.name===e.submitArtifact)}function dr(e,t){return ur(e)?.reviews.map(e=>e.id)??t}function fr(e,t){return e.review===`schema`?[...t]:e.review.filter(e=>t.includes(e))}var pr=[`proposal`,`specs`,`design`,`tasks`],mr={"mate-full":pr,"mate-minimal":[`specs`,`tasks`],"mate-v1":pr},hr={"mate-v1":`mate-full`},gr=[`mate-full`,`mate-minimal`],_r=`mate-full`;function vr(e){return Object.hasOwn(mr,e)}rr.map(e=>e.skill);function yr(e){return Object.hasOwn(hr,e)?hr[e]:e}var br=lr();function xr(e,t){return{id:`review-${e}`,label:`Review ${e}`,kind:`human`,skill:null,artifact:e,group:t.id,groupLabel:t.label,optional:t.optional}}function Sr(e,t=br){let n=dr(t,e);return{stages:t.stages.flatMap(e=>{if(e.kind===`review`)return fr(e,n??[]).map(t=>xr(t,e));let{id:t,label:r,optional:i,steps:a,source:o}=e;return[{id:t,label:r,kind:`skill`,skill:e.entry,optional:i,steps:a,source:o}]}),reviewsKnown:n!==void 0}}new Map(Sr([]).stages.map(e=>[e.id,e.label]));function Cr(e){if(e.submitArtifact!==`openspec`)return[];let t=e.stages.findIndex(e=>e.kind===`skill`&&e.milestone===`exists`);return e.stages.slice(0,t+1)}function wr(e,t){return e.stages.find(e=>e.kind===`skill`&&e.steps.some(e=>e.skill===t))}var Tr={ink:{hex:`#1F2421`,ansi256:235},mateGreen:{hex:`#2E7D5B`,ansi256:29},cream:{hex:`#F4F0E8`,ansi256:255},lightGreen:{hex:`#7FD0A6`,ansi256:115},night:{hex:`#15191A`,ansi256:234}};Tr.mateGreen.hex;function Er(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255};${t>>8&255};${t&255}`}`${Er(Tr.mateGreen.hex)}`;var{ink:Dr,mateGreen:Or,cream:kr,lightGreen:Ar,night:jr}=Tr,Mr={ink:Dr.hex,bg:`#FFFFFF`,muted:`#59625E`,rule:`#E2DED5`,accent:Or.hex,surface:`#F7F5F0`,ok:Or.hex,warn:`#8A5A00`,error:`#B3261E`,info:`#2F5F9E`,neutral:`#66706B`,addBg:`#E4F3EA`,delBg:`#FBE8E6`,hunkBg:`#F1EEE7`},Nr={ink:kr.hex,bg:jr.hex,muted:`#A5AEA9`,rule:`#2D3433`,accent:Ar.hex,surface:`#1C2223`,ok:Ar.hex,warn:`#E3B45C`,error:`#F28B82`,info:`#8DB8F0`,neutral:`#A5AEA9`,addBg:`#16382A`,delBg:`#46211E`,hunkBg:`#232A2B`};({...Mr});export{u as C,l as D,t as E,m as O,f as S,r as T,$n as _,_r as a,p as b,yr as c,nr as d,tr as f,Xn as g,Qn as h,wr as i,i as k,Sr as l,er as m,Mr as n,mr as o,lr as p,Cr as r,gr as s,Nr as t,vr as u,Zn as v,n as w,c as x,d as y};
|
|
@@ -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};
|