@inkeep/open-knowledge 0.61.1 → 0.61.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-harness-probe-DLN-ydKh.mjs → acp-harness-probe-t1lJvQ4a.mjs} +2 -2
- package/dist/cli.mjs +11 -11
- package/dist/constants-D3GZn-dk.mjs +2 -0
- package/dist/{fs-traced-1KTQL4h-.mjs → fs-traced-2B_-YK-g.mjs} +6 -6
- package/dist/fs-traced-DjggEXdh.mjs +1 -0
- package/dist/{git-handle-BnzI58ud.mjs → git-handle-CdQzaja5.mjs} +2 -2
- package/dist/git-handle-Clxj9fr-.mjs +1 -0
- package/dist/index.mjs +161 -161
- package/dist/{init-C5pd7hUk.mjs → init-5SqrHOkp.mjs} +3 -3
- package/dist/init-C7HKweMR.mjs +1 -0
- package/dist/{launch-json-removal-CrLD42cL.mjs → launch-json-removal-DM5PCMXP.mjs} +2 -2
- package/dist/{loader-stWuu4Mn.mjs → loader-DsWNpxDe.mjs} +2 -2
- package/dist/loader-Osy-rk3T.mjs +1 -0
- package/dist/md-manager-DbxE4WzN.mjs +2 -0
- package/dist/{open-browser-CB0sbYH4.mjs → open-browser-xN9OlX1t.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-DAuizf4r.mjs +1 -0
- package/dist/{preview-CL9b4gT5.mjs → preview-DMJ3NAED.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-rkVFPeGI.js → ActivityModeContent-Cn-W_Pc9.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-UM3yi_Jj.js → AgentDiffPane-fqyn3qqK.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-DbKx5B2j.js → AgentThreadClientBinder-BUL6vwPz.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-SvCCpq_g.js → CodeMirrorPropInput-ZXKkJFOY.js} +1 -1
- package/dist/public/assets/{DocumentContext-BrlDlUx7.js → DocumentContext-CuOcLr_j.js} +7 -7
- package/dist/public/assets/{EditorModeToggle-Coj-pKbp.js → EditorModeToggle-rmR5bMw6.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-CMQPWKxH.js → EnableSyncConfirmDialog-IKFvLJ0s.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-Ct_C78n1.js → ExcalidrawDocEditor-DUdD1MdF.js} +1 -1
- package/dist/public/assets/FeedbackForm-DzgyNjac.js +1 -0
- package/dist/public/assets/{GraphPanel-C4IPsveQ.js → GraphPanel-BdYMWZaF.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-BUIlH24A.js → ImportSkillDialog-Cf9s-UGN.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-Q1gGaOab.js → LintConfigEditor-DkncZJhY.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-EYfMUx3g.js +1 -0
- package/dist/public/assets/ManagedArtifactProperties-mqQVguq0.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-DBbbNWFO.js → MermaidDocEditor-DLpabb88.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-DfLhrMek.js → PropertyDisplayRow-CPeDXIFD.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-D5SrIAvZ.js → ReportBugDialogBody-CCniAzNT.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-CkKt8e-E.js → SchemaConfigEditor-_uHnWU3w.js} +1 -1
- package/dist/public/assets/{SessionsHost-DxbKcTfw.js → SessionsHost-DXGYsgWh.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-BaPG44Cx.js → SettingsDialogBody-75kVL106.js} +5 -5
- package/dist/public/assets/{ShareBranchSwitchDialog-BvkvEHCc.js → ShareBranchSwitchDialog-DgbDAJil.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-C9KNKynH.js → ShareReceiveDialog-DmClGCLD.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-CwqxBbfk.js → ShareReceiveMissDialog-DAxO28Lj.js} +1 -1
- package/dist/public/assets/{SkillCostValue-BvB_BW1x.js → SkillCostValue-zpzjADcj.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-D0gTinuX.js → SkillEditBanner-BCRYQ3e4.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-Cb7qSrC0.js → SkillInstallMenu-QQXII2hZ.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-IRuhZu-j.js → SkillOriginInline-BoAKWsbK.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-6i3dV6vs.js → SkillToolbarControls-ovUDGFiC.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-D5EykdNJ.js → SlidesToolbarControls-BBIxMkk8.js} +1 -1
- package/dist/public/assets/{SourceEditor-p9dgTOkJ.js → SourceEditor-fE2VSQ8J.js} +1 -1
- package/dist/public/assets/{TerminalPanel-cl3V5Lv6.js → TerminalPanel-Cy4HfKYz.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-BoxazHdg.js → TerminalWindowApp-C6AUY1UG.js} +1 -1
- package/dist/public/assets/{TextDocEditor-DOoM8Kxy.js → TextDocEditor-dLRRDXfg.js} +1 -1
- package/dist/public/assets/{ThreadView-BxvEDVSr.js → ThreadView-D9Fbdpxf.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-BPuM41-O.js → TimelineDiffPane-DNnhFpvU.js} +1 -1
- package/dist/public/assets/{agent-diff-store-D7oOrlOa.js → agent-diff-store-CZQtUCXL.js} +1 -1
- package/dist/public/assets/auth-state-cache-CvhGKn1-.js +11 -0
- package/dist/public/assets/{client-version-DPop7QlO.js → client-version-CaChkiCH.js} +1 -1
- package/dist/public/assets/{comment-chips-BSXPyCs1.js → comment-chips-DVNORTJ8.js} +1 -1
- package/dist/public/assets/config-provider-oAAIxoES.js +5 -0
- package/dist/public/assets/{dist-YRM6aCj22.js → dist-DKOit9IV2.js} +192 -192
- package/dist/public/assets/{doc-paths-DHGjMfMc.js → doc-paths-DqOWEocR.js} +1 -1
- package/dist/public/assets/{documents-events-Dh2E-mNH.js → documents-events-CswIH8-8.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-8KZtqBfU.js → file-tree-adapter-Ye2De3V1.js} +1 -1
- package/dist/public/assets/{file-tree-utils-mm4DWltG.js → file-tree-utils-DeewwZEM.js} +1 -1
- package/dist/public/assets/{folder-config-api-ReDuYJ0J.js → folder-config-api-DzbfltNv.js} +1 -1
- package/dist/public/assets/i18n-Ds_Fl5Hd.js +1 -0
- package/dist/public/assets/index-TaCyw6y_.js +2098 -0
- package/dist/public/assets/{lint-config-client-DDlKZf1J.js → lint-config-client-Dwop4dqP.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-Cn61TsP6.js → markdownlint-rule-browser-DH858hZX.js} +1 -1
- package/dist/public/assets/navigation-targets-jpdo1ZgU.js +1 -0
- package/dist/public/assets/{open-managed-artifact-tab-DI0a5-3C.js → open-managed-artifact-tab-CgNN9QbB.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BQWmsZRi.js → pending-receive-nav-store-fsDdvtOj.js} +1 -1
- package/dist/public/assets/{progress-DKgTQ0Qz.js → progress-CHBPaNjc.js} +1 -1
- package/dist/public/assets/{prop-types-aV6oiD-U.js → prop-types-Cw5N-nOD.js} +1 -1
- package/dist/public/assets/{receive-store-D1fi7HMJ.js → receive-store-DFDJ0T_F.js} +1 -1
- package/dist/public/assets/{selection-context-4KGHvsgP.js → selection-context-CS5s5L53.js} +1 -1
- package/dist/public/assets/{skill-actions-BndTKw4P.js → skill-actions-CONIft3w.js} +1 -1
- package/dist/public/assets/{skill-scope-TpOVvXXj.js → skill-scope-C_bc3f6T.js} +1 -1
- package/dist/public/assets/{skills-api-Ci4vZCl_.js → skills-api-B3AiUodv.js} +1 -1
- package/dist/public/assets/{src-Dyjlw1SL.js → src-Dn75jB9p.js} +1 -1
- package/dist/public/assets/{tag-pill-input-ltY20AtL.js → tag-pill-input-BFR_8nvj.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-Bq0cHa0H.js → target-navigation-intent-5nit-2Ve.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-MwCkMfQx.js → terminal-cli-display-DQFap0a9.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-cj2KCTDl.js → terminal-launch-events-DxtBCSNL.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-ElOB2Hsl.js → terminal-telemetry-Cq512ASb.js} +1 -1
- package/dist/public/assets/typing-burst-detector-Bhy83GCZ.js +8 -0
- package/dist/public/assets/{uninstall-CJfdIccl.js → uninstall-VS8HkqWd.js} +1 -1
- package/dist/public/assets/{use-activity-panel-AklD6yAB.js → use-activity-panel-BPQcffqO.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-zpd8fyW1.js → use-apply-config-color-theme-DT9ZBAuW.js} +1 -1
- package/dist/public/assets/{use-collab-url-BIoe0OLV.js → use-collab-url-CaC2gD2v.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-BgtSx-n3.js → use-live-xterm-theme-xXp1UYmJ.js} +1 -1
- package/dist/public/assets/{use-open-skill-CLhiKLe2.js → use-open-skill-DdfCbjRH.js} +1 -1
- package/dist/public/assets/{use-popular-skills-CSwbHrqM.js → use-popular-skills-DRwm43Dp.js} +1 -1
- package/dist/public/assets/{use-settings-route-BuFQqdtV.js → use-settings-route-BGxa3SPN.js} +1 -1
- package/dist/public/assets/{use-skill-origin-CbbiS8DZ.js → use-skill-origin-CnlwuiEX.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-GezhypT9.js → use-terminal-enabled-B3CRPNAH.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-DyOMjIES.js → use-timeline-entry-diff-Cta4x9Tk.js} +1 -1
- package/dist/public/assets/{use-workspace-C3C8xAY5.js → use-workspace-CQYB3HLR.js} +1 -1
- package/dist/public/index.html +45 -45
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-DjnqUBMP.mjs → repair-launch-json-Ul9-Kphl.mjs} +2 -2
- package/dist/{repair-mcp-configs-CpTDkONv.mjs → repair-mcp-configs-DI9-mCNA.mjs} +2 -2
- package/dist/repair-skills-C4NosCCh.mjs +1 -0
- package/dist/{repair-skills-Cs-CbtpF.mjs → repair-skills-DySL7Lc9.mjs} +2 -2
- package/dist/{resolve-project-root-BD_5TDzP.mjs → resolve-project-root-BDV317uB.mjs} +2 -2
- package/dist/{server-lock-DCzdk2Up.mjs → server-lock-BFHu2BWp.mjs} +2 -2
- package/dist/server-lock-DzPLyikk.mjs +1 -0
- package/dist/{skill-teardown-TMX-h8on.mjs → skill-teardown-DTg2NyL3.mjs} +2 -2
- package/dist/{sleep-DXvB05wr.mjs → sleep-DhRrtbfG.mjs} +6 -6
- package/dist/src-B9XENgF4.mjs +357 -0
- package/dist/{src-D28v5dI-.mjs → src-BMc6VYxR.mjs} +1 -1
- package/dist/{src-BAp5xlph.mjs → src-BpAtKjdr.mjs} +3 -3
- package/dist/src-C49kugTg.mjs +1 -0
- package/dist/{src-vJKK8Bgd.mjs → src-C8z0M4Ib.mjs} +71 -71
- package/dist/start-De77XKSr.mjs +1 -0
- package/dist/{start-HrTBO3iw.mjs → start-R7eR24jP.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-BBUXK9MW.mjs +0 -2
- package/dist/fs-traced-Dak_kryQ.mjs +0 -1
- package/dist/git-handle-M-kQfBzM.mjs +0 -1
- package/dist/init-oCd8hAAp.mjs +0 -1
- package/dist/loader-CxnK-gJ7.mjs +0 -1
- package/dist/md-manager-C7XAJMWr.mjs +0 -2
- package/dist/preview-7gt5pyCx.mjs +0 -1
- package/dist/public/assets/FeedbackForm-cUkhA17t.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-B4xOs3fA.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-DUIo-gDU.js +0 -1
- package/dist/public/assets/auth-state-cache-1gTw3GkH.js +0 -11
- package/dist/public/assets/config-provider-CYqYSyJg.js +0 -5
- package/dist/public/assets/i18n-BQpXlvfY.js +0 -1
- package/dist/public/assets/index-hC142Nnf.js +0 -2098
- package/dist/public/assets/navigation-targets-CFQds_7M.js +0 -1
- package/dist/public/assets/typing-burst-detector-kXx1cN6a.js +0 -8
- package/dist/repair-skills-Bn47U59J.mjs +0 -1
- package/dist/server-lock-CV9U-jz6.mjs +0 -1
- package/dist/src-Dm-FGyIz.mjs +0 -357
- package/dist/src-LTSxNEa8.mjs +0 -1
- package/dist/start-BPFyHeud.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{n as s}from"./dist-DTX2HxC82.js";import{t as c}from"./desktop-bridge-types-rBjHIYSI.js";import{n as ee,t as l}from"./git-branch-BEl3Boky.js";import{t as u}from"./spinner-DmibE6UV.js";import{n as te,t as ne}from"./miss-dialog-store-CdkrAlK3.js";import{a as re,c as ie,i as ae,n as oe,o as d,s as se,t as ce}from"./dialog-DD-GTVf9.js";import{r as f,t as p}from"./auth-prompt-store-vAFATIFt.js";import{a as m,n as h}from"./receive-store-D1fi7HMJ.js";import{t as le}from"./share-metadata-rows-DPgPU-ev.js";var g=e(n(),1),ue=a();function de(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function fe(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function _(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var pe={phase:`loading`};function me(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function he(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ge(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function _e(e){return de(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ve(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ye(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function be(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=_(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function xe(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0}}:{state:e}}var v=t();function Se(e){return c(e.repositoryTarget)}function Ce(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...Se(e).split(`/`).slice(0,e.contentRootDepth),...t===``?[]:t.split(`/`)].join(`/`);return{kind:e.target.kind,path:t,repositoryPath:n,...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function we(e){return e!==null&&e.kind===`project-branch-switch`}function y(e){let t=(0,ue.c)(217),{bridge:n,store:a}=e,p=a===void 0?h:a,{_}=i(),y=(0,g.useSyncExternalStore)(p.subscribe,p.getSnapshot,Me),[b,x]=(0,g.useState)(pe),Ne=(0,g.useRef)(!1),Pe=(0,g.useRef)(!1),Fe=(0,g.useRef)(!1),Ie=(0,g.useRef)(null),Le;t[0]===y?Le=t[1]:(Le=we(y)?y:null,t[0]=y,t[1]=Le);let S=Le,Re;t[2]!==_||t[3]!==S?.share.target.kind?(Re=S?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=S?.share.target.kind,t[4]=Re):Re=t[4];let C=Re,ze;t[5]===S?ze=t[6]:(ze=()=>{x(pe),Ne.current=!1,Pe.current=!1,Fe.current=!1,Ie.current=S},t[5]=S,t[6]=ze);let Be;t[7]===y?Be=t[8]:(Be=[y],t[7]=y,t[8]=Be),(0,g.useEffect)(ze,Be);let Ve;t[9]!==S||t[10]!==n?(Ve=()=>{if(!S||Ne.current)return;Ne.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.repositoryTarget.kind,path:Se(S.share)}).then(t=>{e||x(e=>me(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),x(je))}),()=>{e=!0}},t[9]=S,t[10]=n,t[11]=Ve):Ve=t[11];let He;t[12]===S?He=t[13]:(He=[S],t[12]=S,t[13]=He),(0,g.useEffect)(Ve,He);let Ue;t[14]!==S||t[15]!==b.info||t[16]!==b.phase||t[17]!==n?(Ue=()=>{if(!S||b.phase!==`ready`||Fe.current||!_e(b.info))return;Fe.current=!0,x(ve);let e=S;n.project.fetchTargetStatus({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.target.kind,path:Se(S.share),...S.share.contentRootDepth===null?{}:{contentRootDepth:S.share.contentRootDepth}}).then(t=>{Ie.current===e&&x(e=>ye(e,t))}).catch(t=>{Ie.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),x(Ae))})},t[14]=S,t[15]=b.info,t[16]=b.phase,t[17]=n,t[18]=Ue):Ue=t[18];let We;t[19]!==S||t[20]!==b.phase?(We=[b.phase,S],t[19]=S,t[20]=b.phase,t[21]=We):We=t[21],(0,g.useEffect)(Ue,We);let Ge;t[22]!==S||t[23]!==b.phase||t[24]!==b.resolution||t[25]!==p?(Ge=()=>{if(b.phase!==`verdict`)return;let{kind:e}=b.resolution;e!==`deleted`&&e!==`never-on-branch`||S&&(ne.arm({kind:S.share.target.kind,path:c(S.share.target),repositoryPath:Se(S.share),...S.share.contentRootDepth===null?{}:{contentRootDepth:S.share.contentRootDepth},branch:S.share.branch}),p.dismiss())},t[22]=S,t[23]=b.phase,t[24]=b.resolution,t[25]=p,t[26]=Ge):Ge=t[26];let Ke;t[27]!==S||t[28]!==b||t[29]!==p?(Ke=[b,S,p],t[27]=S,t[28]=b,t[29]=p,t[30]=Ke):Ke=t[30],(0,g.useEffect)(Ge,Ke);let qe;t[31]!==b.phase||t[32]!==b.resolution?(qe=()=>{b.phase===`verdict`&&console.log(m({verdict_cell:b.resolution.kind}))},t[31]=b.phase,t[32]=b.resolution,t[33]=qe):qe=t[33];let Je;t[34]===b?Je=t[35]:(Je=[b],t[34]=b,t[35]=Je),(0,g.useEffect)(qe,Je);let Ye;t[36]!==_||t[37]!==S||t[38]!==b.pendingDoc||t[39]!==b.phase||t[40]!==n||t[41]!==p||t[42]!==C?(Ye=()=>{if(b.phase!==`awaiting-cc1-recycle`||!S)return;let e=S.share.branch,t=b.pendingDoc;if(!e){p.dismiss();return}if(Pe.current)return;Pe.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:S.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(m({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:S.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(S.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(_({id:`gQV-9w`,values:{targetNoun:C}}))}),p.dismiss();return}console.log(m({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(_({id:`LBwUR6`,values:{targetNoun:C}})),p.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(_({id:`Jw6EC4`,values:{targetNoun:C}})),p.dismiss())}),()=>{r=!0}},t[36]=_,t[37]=S,t[38]=b.pendingDoc,t[39]=b.phase,t[40]=n,t[41]=p,t[42]=C,t[43]=Ye):Ye=t[43];let Xe;if(t[44]!==S||t[45]!==b.phase?(Xe=[b.phase,S],t[44]=S,t[45]=b.phase,t[46]=Xe):Xe=t[46],(0,g.useEffect)(Ye,Xe),!S)return null;let{share:w,projectPath:T,currentBranch:Ze}=S,E=w.branch,Qe;t[47]!==_||t[48]!==n.project||t[49]!==T||t[50]!==E||t[51]!==p?(Qe=function(e,t,r){console.log(m({branch_dialog_action:`switch`,branch_action:`switch`,branch:E,verdict_cell:r})),x(t=>he(t,e)),n.project.runCheckout(t?{projectPath:T,branch:E,fastForward:!0}:{projectPath:T,branch:E}).then(e=>{let t=null,n=!1;x(r=>{let{state:i,sideEffect:a}=be(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(_({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?s.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(_({id:`c863eW`,values:{shareBranch:E}})),n&&p.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),x(ke),s.error(_({id:`c863eW`,values:{shareBranch:E}}))})},t[47]=_,t[48]=n.project,t[49]=T,t[50]=E,t[51]=p,t[52]=Qe):Qe=t[52];let D=Qe,$e;t[53]!==b.info||t[54]!==b.phase||t[55]!==D||t[56]!==w.target?($e=function(){b.phase===`ready`&&de(b.info).switchEnabled&&D(c(w.target),!1)},t[53]=b.info,t[54]=b.phase,t[55]=D,t[56]=w.target,t[57]=$e):$e=t[57];let et=$e,tt;t[58]!==b.phase||t[59]!==b.resolution||t[60]!==D||t[61]!==w.target?(tt=function(){b.phase===`verdict`&&D(c(w.target),!0,b.resolution.kind)},t[58]=b.phase,t[59]=b.resolution,t[60]=D,t[61]=w.target,t[62]=tt):tt=t[62];let nt=tt,rt;t[63]!==b.phase||t[64]!==b.resolution||t[65]!==D?(rt=function(){b.phase===`verdict`&&b.resolution.kind===`renamed`&&D(b.resolution.renamedTo,!0,b.resolution.kind)},t[63]=b.phase,t[64]=b.resolution,t[65]=D,t[66]=rt):rt=t[66];let it=rt,at;t[67]!==b.phase||t[68]!==b.resolution||t[69]!==D||t[70]!==w.target?(at=function(){b.phase===`verdict`&&D(c(w.target),!1,b.resolution.kind)},t[67]=b.phase,t[68]=b.resolution,t[69]=D,t[70]=w.target,t[71]=at):at=t[71];let ot=at,st;t[72]!==_||t[73]!==n.project||t[74]!==T||t[75]!==w||t[76]!==E||t[77]!==p||t[78]!==C?(st=function(){console.log(m({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(w)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(_({id:`b5aNbi`,values:{targetNoun:C}}))}),p.dismiss()},t[72]=_,t[73]=n.project,t[74]=T,t[75]=w,t[76]=E,t[77]=p,t[78]=C,t[79]=st):st=t[79];let ct=st,lt;t[80]!==_||t[81]!==E?(lt=function(e,t,n){if(e===`fetch-failed`&&n){s.error(_({id:`gfb-CM`}),{action:{label:_({id:`5lWFkC`}),onClick:Oe}});return}switch(e){case`helper-not-found`:{let e=t??_({id:`cHhH3i`});s.error(_({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(_({id:`NJyQi_`,values:{shareBranch:E}}));return;case`fetch-failed`:s.error(_({id:`bWLmRK`}));return;case`already-checked-out`:s.error(_({id:`ljHjfg`}));return;case`branch-exists`:s.error(_({id:`h3QZcB`,values:{shareBranch:E}}));return;case`path-exists`:s.error(_({id:`cN1Gcp`,values:{shareBranch:E}}));return;case`no-git`:s.error(_({id:`CFnavk`}));return;case`empty-repo`:s.error(_({id:`5IgYAM`}));return;case`invalid-branch`:s.error(_({id:`JfPuv7`,values:{shareBranch:E}}));return;case`proxy-null`:case`error`:s.error(_({id:`e8zYa8`,values:{shareBranch:E}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=_,t[81]=E,t[82]=lt):lt=t[82];let ut=lt,dt;t[83]!==_||t[84]!==n.project||t[85]!==w||t[86]!==E||t[87]!==ut||t[88]!==p?(dt=function(e){let t=null,r,i,a=!1,o=null;if(x(n=>{let{state:s,sideEffect:c}=xe(n,e);return c&&(t=c.reason,r=c.helper,i=c.authFailed,a=s.phase===`dismissed`),s.phase===`opening-worktree`&&(o=s.path),s}),t!==null&&(console.log(m({branch_dialog_action:`open-worktree-failed:${t}`,branch:E})),ut(t,r,i)),o!==null){f();let e=o;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Ce(w),pendingBranch:E}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()}a&&p.dismiss()},t[83]=_,t[84]=n.project,t[85]=w,t[86]=E,t[87]=ut,t[88]=p,t[89]=dt):dt=t[89];let ft=dt,pt;t[90]!==ft||t[91]!==b.phase||t[92]!==n.worktree||t[93]!==E?(pt=function(){b.phase===`ready`&&(console.log(m({branch_dialog_action:`open-worktree`,branch:E})),x(ge),n.worktree.checkout({branch:E}).then(e=>{ft(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ft(null)}))},t[90]=ft,t[91]=b.phase,t[92]=n.worktree,t[93]=E,t[94]=pt):pt=t[94];let mt=pt,ht;t[95]!==_||t[96]!==b.otherWorktreePath||t[97]!==b.phase||t[98]!==n.project||t[99]!==w||t[100]!==E||t[101]!==p?(ht=function(){if(b.phase!==`branch-in-other-worktree`)return;let e=b.otherWorktreePath;console.log(m({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(w),pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()},t[95]=_,t[96]=b.otherWorktreePath,t[97]=b.phase,t[98]=n.project,t[99]=w,t[100]=E,t[101]=p,t[102]=ht):ht=t[102];let gt=ht,_t;t[103]!==b.phase||t[104]!==b.resolution||t[105]!==p?(_t=function(){console.log(m({branch_dialog_action:`cancel`,verdict_cell:b.phase===`verdict`?b.resolution.kind:void 0})),p.dismiss()},t[103]=b.phase,t[104]=b.resolution,t[105]=p,t[106]=_t):_t=t[106];let O=_t,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[107]!==_||t[108]!==b.info||t[109]!==b.otherWorktreePath||t[110]!==b.phase||t[111]!==b.resolution||t[112]!==O||t[113]!==Ze||t[114]!==w.branch||t[115]!==w.owner||t[116]!==w.repo||t[117]!==w.target||t[118]!==E||t[119]!==C){K=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?de(b.info):null;let e;t[139]!==b.info||t[140]!==b.phase||t[141]!==Ze?(e=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?fe(b.info):Ze??`HEAD`,t[139]=b.info,t[140]=b.phase,t[141]=Ze,t[142]=e):e=t[142];let n=e;F=b.phase===`switching`||b.phase===`awaiting-cc1-recycle`,M=b.phase===`creating-worktree`;let i;t[143]===_?i=t[144]:(i=_({id:`OuY8t9`}),t[143]=_,t[144]=i),N=i;let a;t[145]===_?a=t[146]:(a=_({id:`XZkdtg`}),t[145]=_,t[146]=a),P=a;let o;t[147]===_?o=t[148]:(o=_({id:`VTulZj`}),t[147]=_,t[148]=o),q=o;let s=b.phase===`loading`,ee=b.phase===`error`;j=ce,W=!0,t[149]===O?G=t[150]:(G=e=>{e||O()},t[149]=O,t[150]=G),A=ae,z=`sm:max-w-xl`,B=`share-branch-switch-dialog`,V=De,H=Ee;let l;t[151]===C?l=t[152]:(l=(0,v.jsx)(ie,{children:(0,v.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:C}})}),t[151]=C,t[152]=l);let te=w.owner,ne=w.repo,d;t[153]===w.target?d=t[154]:(d=c(w.target),t[153]=w.target,t[154]=d);let f;t[155]!==w.owner||t[156]!==w.repo||t[157]!==d?(f=(0,v.jsx)(re,{className:`sr-only`,children:(0,v.jsx)(r,{id:`f8jU-L`,values:{0:te,1:ne,2:d}})}),t[155]=w.owner,t[156]=w.repo,t[157]=d,t[158]=f):f=t[158],t[159]!==l||t[160]!==f?(U=(0,v.jsxs)(se,{children:[l,f]}),t[159]=l,t[160]=f,t[161]=U):U=t[161],k=oe;let p=w.owner,m=w.repo,h;t[162]===w.target?h=t[163]:(h=c(w.target),t[162]=w.target,t[163]=h),t[164]!==w.branch||t[165]!==w.owner||t[166]!==w.repo||t[167]!==w.target.kind||t[168]!==h?(I=(0,v.jsx)(`div`,{className:`mb-4`,children:(0,v.jsx)(le,{owner:p,repo:m,path:h,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=w.branch,t[165]=w.owner,t[166]=w.repo,t[167]=w.target.kind,t[168]=h,t[169]=I):I=t[169],L=b.phase===`branch-in-other-worktree`?(0,v.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,v.jsx)(`p`,{className:`leading-6`,children:(0,v.jsx)(r,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,v.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:b.otherWorktreePath})]}):b.phase===`verdict-pending`?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,v.jsx)(r,{id:`Uay5NL`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`renamed`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,v.jsx)(r,{id:`P0HC30`,values:{0:b.resolution.renamedTo,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`diverged`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,v.jsx)(r,{id:`kLv8d3`,values:{shareBranch:E,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):s?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`jerqF0`})]}):ee?(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,v.jsx)(r,{id:`w4hMYl`})}):K?.kind===`D`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`DTI-fp`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):K?.kind===`B`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`_902BE`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),R=K&&!K.switchEnabled&&K.conflictingFiles.length>0?(0,v.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,v.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,v.jsx)(r,{id:`n2lRue`})}),(0,v.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:K.conflictingFiles.map(Te)})]}):null,t[107]=_,t[108]=b.info,t[109]=b.otherWorktreePath,t[110]=b.phase,t[111]=b.resolution,t[112]=O,t[113]=Ze,t[114]=w.branch,t[115]=w.owner,t[116]=w.repo,t[117]=w.target,t[118]=E,t[119]=C,t[120]=k,t[121]=A,t[122]=j,t[123]=M,t[124]=N,t[125]=P,t[126]=F,t[127]=I,t[128]=L,t[129]=R,t[130]=z,t[131]=B,t[132]=V,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=q}else k=t[120],A=t[121],j=t[122],M=t[123],N=t[124],P=t[125],F=t[126],I=t[127],L=t[128],R=t[129],z=t[130],B=t[131],V=t[132],H=t[133],U=t[134],W=t[135],G=t[136],K=t[137],q=t[138];let J;t[170]===F?J=t[171]:(J=F?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=F,t[171]=J);let Y;t[172]===M?Y=t[173]:(Y=M?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=M,t[173]=Y);let X;t[174]!==k||t[175]!==I||t[176]!==L||t[177]!==R||t[178]!==J||t[179]!==Y?(X=(0,v.jsxs)(k,{children:[I,L,R,J,Y]}),t[174]=k,t[175]=I,t[176]=L,t[177]=R,t[178]=J,t[179]=Y,t[180]=X):X=t[180];let vt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,v.jsx)(r,{id:`dEgA5A`}),t[181]=vt):vt=t[181];let Z;t[182]===O?Z=t[183]:(Z=(0,v.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:O,"data-testid":`share-branch-switch-cancel`,children:vt}),t[182]=O,t[183]=Z);let Q;t[184]!==b.phase||t[185]!==b.resolution||t[186]!==M||t[187]!==ct||t[188]!==it||t[189]!==mt||t[190]!==gt||t[191]!==ot||t[192]!==et||t[193]!==nt||t[194]!==N||t[195]!==P||t[196]!==F||t[197]!==K||t[198]!==q?(Q=b.phase===`branch-in-other-worktree`?(0,v.jsx)(o,{onClick:gt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,v.jsx)(r,{id:`hyCxJY`})}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`uA_jXp`})]}):b.resolution.kind===`renamed`?(0,v.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`AItsE5`})]}):b.resolution.kind===`diverged`?(0,v.jsxs)(o,{onClick:ot,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),P]}):null:(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[K?.openCurrentEnabled?(0,v.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ct,disabled:F||M,"data-testid":`share-branch-switch-open-current`,children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),N]}):null,(0,v.jsx)(o,{variant:`outline`,onClick:et,disabled:!K?.switchEnabled||F||M,"aria-disabled":!K?.switchEnabled||F||M,"aria-describedby":K&&!K.switchEnabled&&K.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:F?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),P]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),P]})}),(0,v.jsx)(o,{onClick:mt,disabled:!K||F||M,"data-testid":`share-branch-switch-worktree`,children:M?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),q]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),q]})})]}),t[184]=b.phase,t[185]=b.resolution,t[186]=M,t[187]=ct,t[188]=it,t[189]=mt,t[190]=gt,t[191]=ot,t[192]=et,t[193]=nt,t[194]=N,t[195]=P,t[196]=F,t[197]=K,t[198]=q,t[199]=Q):Q=t[199];let yt;t[200]!==Z||t[201]!==Q?(yt=(0,v.jsxs)(d,{className:`sm:justify-between`,children:[Z,Q]}),t[200]=Z,t[201]=Q,t[202]=yt):yt=t[202];let $;t[203]!==A||t[204]!==z||t[205]!==B||t[206]!==V||t[207]!==H||t[208]!==U||t[209]!==X||t[210]!==yt?($=(0,v.jsxs)(A,{className:z,"data-testid":B,onInteractOutside:V,onPointerDownOutside:H,children:[U,X,yt]}),t[203]=A,t[204]=z,t[205]=B,t[206]=V,t[207]=H,t[208]=U,t[209]=X,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==j||t[213]!==W||t[214]!==G||t[215]!==$?(bt=(0,v.jsx)(j,{open:W,onOpenChange:G,children:$}),t[212]=j,t[213]=W,t[214]=G,t[215]=$,t[216]=bt):bt=t[216],bt}function Te(e){return(0,v.jsx)(`li`,{children:(0,v.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(){return p.request()}function ke(e){return be(e,null).state}function Ae(e){return ye(e,null)}function je(e){return me(e,null)}function Me(){return null}export{y as ShareBranchSwitchDialog};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{n as s}from"./dist-DTX2HxC82.js";import{t as c}from"./desktop-bridge-types-rBjHIYSI.js";import{n as ee,t as l}from"./git-branch-BEl3Boky.js";import{t as u}from"./spinner-DmibE6UV.js";import{n as te,t as ne}from"./miss-dialog-store-CdkrAlK3.js";import{a as re,c as ie,i as ae,n as oe,o as d,s as se,t as ce}from"./dialog-DD-GTVf9.js";import{r as f,t as p}from"./auth-prompt-store-vAFATIFt.js";import{a as m,n as h}from"./receive-store-DFDJ0T_F.js";import{t as le}from"./share-metadata-rows-DPgPU-ev.js";var g=e(n(),1),ue=a();function de(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function fe(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function _(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var pe={phase:`loading`};function me(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function he(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ge(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function _e(e){return de(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ve(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ye(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function be(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=_(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function xe(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0}}:{state:e}}var v=t();function Se(e){return c(e.repositoryTarget)}function Ce(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...Se(e).split(`/`).slice(0,e.contentRootDepth),...t===``?[]:t.split(`/`)].join(`/`);return{kind:e.target.kind,path:t,repositoryPath:n,...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function we(e){return e!==null&&e.kind===`project-branch-switch`}function y(e){let t=(0,ue.c)(217),{bridge:n,store:a}=e,p=a===void 0?h:a,{_}=i(),y=(0,g.useSyncExternalStore)(p.subscribe,p.getSnapshot,Me),[b,x]=(0,g.useState)(pe),Ne=(0,g.useRef)(!1),Pe=(0,g.useRef)(!1),Fe=(0,g.useRef)(!1),Ie=(0,g.useRef)(null),Le;t[0]===y?Le=t[1]:(Le=we(y)?y:null,t[0]=y,t[1]=Le);let S=Le,Re;t[2]!==_||t[3]!==S?.share.target.kind?(Re=S?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=S?.share.target.kind,t[4]=Re):Re=t[4];let C=Re,ze;t[5]===S?ze=t[6]:(ze=()=>{x(pe),Ne.current=!1,Pe.current=!1,Fe.current=!1,Ie.current=S},t[5]=S,t[6]=ze);let Be;t[7]===y?Be=t[8]:(Be=[y],t[7]=y,t[8]=Be),(0,g.useEffect)(ze,Be);let Ve;t[9]!==S||t[10]!==n?(Ve=()=>{if(!S||Ne.current)return;Ne.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.repositoryTarget.kind,path:Se(S.share)}).then(t=>{e||x(e=>me(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),x(je))}),()=>{e=!0}},t[9]=S,t[10]=n,t[11]=Ve):Ve=t[11];let He;t[12]===S?He=t[13]:(He=[S],t[12]=S,t[13]=He),(0,g.useEffect)(Ve,He);let Ue;t[14]!==S||t[15]!==b.info||t[16]!==b.phase||t[17]!==n?(Ue=()=>{if(!S||b.phase!==`ready`||Fe.current||!_e(b.info))return;Fe.current=!0,x(ve);let e=S;n.project.fetchTargetStatus({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.target.kind,path:Se(S.share),...S.share.contentRootDepth===null?{}:{contentRootDepth:S.share.contentRootDepth}}).then(t=>{Ie.current===e&&x(e=>ye(e,t))}).catch(t=>{Ie.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),x(Ae))})},t[14]=S,t[15]=b.info,t[16]=b.phase,t[17]=n,t[18]=Ue):Ue=t[18];let We;t[19]!==S||t[20]!==b.phase?(We=[b.phase,S],t[19]=S,t[20]=b.phase,t[21]=We):We=t[21],(0,g.useEffect)(Ue,We);let Ge;t[22]!==S||t[23]!==b.phase||t[24]!==b.resolution||t[25]!==p?(Ge=()=>{if(b.phase!==`verdict`)return;let{kind:e}=b.resolution;e!==`deleted`&&e!==`never-on-branch`||S&&(ne.arm({kind:S.share.target.kind,path:c(S.share.target),repositoryPath:Se(S.share),...S.share.contentRootDepth===null?{}:{contentRootDepth:S.share.contentRootDepth},branch:S.share.branch}),p.dismiss())},t[22]=S,t[23]=b.phase,t[24]=b.resolution,t[25]=p,t[26]=Ge):Ge=t[26];let Ke;t[27]!==S||t[28]!==b||t[29]!==p?(Ke=[b,S,p],t[27]=S,t[28]=b,t[29]=p,t[30]=Ke):Ke=t[30],(0,g.useEffect)(Ge,Ke);let qe;t[31]!==b.phase||t[32]!==b.resolution?(qe=()=>{b.phase===`verdict`&&console.log(m({verdict_cell:b.resolution.kind}))},t[31]=b.phase,t[32]=b.resolution,t[33]=qe):qe=t[33];let Je;t[34]===b?Je=t[35]:(Je=[b],t[34]=b,t[35]=Je),(0,g.useEffect)(qe,Je);let Ye;t[36]!==_||t[37]!==S||t[38]!==b.pendingDoc||t[39]!==b.phase||t[40]!==n||t[41]!==p||t[42]!==C?(Ye=()=>{if(b.phase!==`awaiting-cc1-recycle`||!S)return;let e=S.share.branch,t=b.pendingDoc;if(!e){p.dismiss();return}if(Pe.current)return;Pe.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:S.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(m({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:S.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(S.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(_({id:`gQV-9w`,values:{targetNoun:C}}))}),p.dismiss();return}console.log(m({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(_({id:`LBwUR6`,values:{targetNoun:C}})),p.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(_({id:`Jw6EC4`,values:{targetNoun:C}})),p.dismiss())}),()=>{r=!0}},t[36]=_,t[37]=S,t[38]=b.pendingDoc,t[39]=b.phase,t[40]=n,t[41]=p,t[42]=C,t[43]=Ye):Ye=t[43];let Xe;if(t[44]!==S||t[45]!==b.phase?(Xe=[b.phase,S],t[44]=S,t[45]=b.phase,t[46]=Xe):Xe=t[46],(0,g.useEffect)(Ye,Xe),!S)return null;let{share:w,projectPath:T,currentBranch:Ze}=S,E=w.branch,Qe;t[47]!==_||t[48]!==n.project||t[49]!==T||t[50]!==E||t[51]!==p?(Qe=function(e,t,r){console.log(m({branch_dialog_action:`switch`,branch_action:`switch`,branch:E,verdict_cell:r})),x(t=>he(t,e)),n.project.runCheckout(t?{projectPath:T,branch:E,fastForward:!0}:{projectPath:T,branch:E}).then(e=>{let t=null,n=!1;x(r=>{let{state:i,sideEffect:a}=be(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(_({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?s.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(_({id:`c863eW`,values:{shareBranch:E}})),n&&p.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),x(ke),s.error(_({id:`c863eW`,values:{shareBranch:E}}))})},t[47]=_,t[48]=n.project,t[49]=T,t[50]=E,t[51]=p,t[52]=Qe):Qe=t[52];let D=Qe,$e;t[53]!==b.info||t[54]!==b.phase||t[55]!==D||t[56]!==w.target?($e=function(){b.phase===`ready`&&de(b.info).switchEnabled&&D(c(w.target),!1)},t[53]=b.info,t[54]=b.phase,t[55]=D,t[56]=w.target,t[57]=$e):$e=t[57];let et=$e,tt;t[58]!==b.phase||t[59]!==b.resolution||t[60]!==D||t[61]!==w.target?(tt=function(){b.phase===`verdict`&&D(c(w.target),!0,b.resolution.kind)},t[58]=b.phase,t[59]=b.resolution,t[60]=D,t[61]=w.target,t[62]=tt):tt=t[62];let nt=tt,rt;t[63]!==b.phase||t[64]!==b.resolution||t[65]!==D?(rt=function(){b.phase===`verdict`&&b.resolution.kind===`renamed`&&D(b.resolution.renamedTo,!0,b.resolution.kind)},t[63]=b.phase,t[64]=b.resolution,t[65]=D,t[66]=rt):rt=t[66];let it=rt,at;t[67]!==b.phase||t[68]!==b.resolution||t[69]!==D||t[70]!==w.target?(at=function(){b.phase===`verdict`&&D(c(w.target),!1,b.resolution.kind)},t[67]=b.phase,t[68]=b.resolution,t[69]=D,t[70]=w.target,t[71]=at):at=t[71];let ot=at,st;t[72]!==_||t[73]!==n.project||t[74]!==T||t[75]!==w||t[76]!==E||t[77]!==p||t[78]!==C?(st=function(){console.log(m({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(w)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(_({id:`b5aNbi`,values:{targetNoun:C}}))}),p.dismiss()},t[72]=_,t[73]=n.project,t[74]=T,t[75]=w,t[76]=E,t[77]=p,t[78]=C,t[79]=st):st=t[79];let ct=st,lt;t[80]!==_||t[81]!==E?(lt=function(e,t,n){if(e===`fetch-failed`&&n){s.error(_({id:`gfb-CM`}),{action:{label:_({id:`5lWFkC`}),onClick:Oe}});return}switch(e){case`helper-not-found`:{let e=t??_({id:`cHhH3i`});s.error(_({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(_({id:`NJyQi_`,values:{shareBranch:E}}));return;case`fetch-failed`:s.error(_({id:`bWLmRK`}));return;case`already-checked-out`:s.error(_({id:`ljHjfg`}));return;case`branch-exists`:s.error(_({id:`h3QZcB`,values:{shareBranch:E}}));return;case`path-exists`:s.error(_({id:`cN1Gcp`,values:{shareBranch:E}}));return;case`no-git`:s.error(_({id:`CFnavk`}));return;case`empty-repo`:s.error(_({id:`5IgYAM`}));return;case`invalid-branch`:s.error(_({id:`JfPuv7`,values:{shareBranch:E}}));return;case`proxy-null`:case`error`:s.error(_({id:`e8zYa8`,values:{shareBranch:E}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=_,t[81]=E,t[82]=lt):lt=t[82];let ut=lt,dt;t[83]!==_||t[84]!==n.project||t[85]!==w||t[86]!==E||t[87]!==ut||t[88]!==p?(dt=function(e){let t=null,r,i,a=!1,o=null;if(x(n=>{let{state:s,sideEffect:c}=xe(n,e);return c&&(t=c.reason,r=c.helper,i=c.authFailed,a=s.phase===`dismissed`),s.phase===`opening-worktree`&&(o=s.path),s}),t!==null&&(console.log(m({branch_dialog_action:`open-worktree-failed:${t}`,branch:E})),ut(t,r,i)),o!==null){f();let e=o;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Ce(w),pendingBranch:E}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()}a&&p.dismiss()},t[83]=_,t[84]=n.project,t[85]=w,t[86]=E,t[87]=ut,t[88]=p,t[89]=dt):dt=t[89];let ft=dt,pt;t[90]!==ft||t[91]!==b.phase||t[92]!==n.worktree||t[93]!==E?(pt=function(){b.phase===`ready`&&(console.log(m({branch_dialog_action:`open-worktree`,branch:E})),x(ge),n.worktree.checkout({branch:E}).then(e=>{ft(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ft(null)}))},t[90]=ft,t[91]=b.phase,t[92]=n.worktree,t[93]=E,t[94]=pt):pt=t[94];let mt=pt,ht;t[95]!==_||t[96]!==b.otherWorktreePath||t[97]!==b.phase||t[98]!==n.project||t[99]!==w||t[100]!==E||t[101]!==p?(ht=function(){if(b.phase!==`branch-in-other-worktree`)return;let e=b.otherWorktreePath;console.log(m({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(w),pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()},t[95]=_,t[96]=b.otherWorktreePath,t[97]=b.phase,t[98]=n.project,t[99]=w,t[100]=E,t[101]=p,t[102]=ht):ht=t[102];let gt=ht,_t;t[103]!==b.phase||t[104]!==b.resolution||t[105]!==p?(_t=function(){console.log(m({branch_dialog_action:`cancel`,verdict_cell:b.phase===`verdict`?b.resolution.kind:void 0})),p.dismiss()},t[103]=b.phase,t[104]=b.resolution,t[105]=p,t[106]=_t):_t=t[106];let O=_t,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[107]!==_||t[108]!==b.info||t[109]!==b.otherWorktreePath||t[110]!==b.phase||t[111]!==b.resolution||t[112]!==O||t[113]!==Ze||t[114]!==w.branch||t[115]!==w.owner||t[116]!==w.repo||t[117]!==w.target||t[118]!==E||t[119]!==C){K=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?de(b.info):null;let e;t[139]!==b.info||t[140]!==b.phase||t[141]!==Ze?(e=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?fe(b.info):Ze??`HEAD`,t[139]=b.info,t[140]=b.phase,t[141]=Ze,t[142]=e):e=t[142];let n=e;F=b.phase===`switching`||b.phase===`awaiting-cc1-recycle`,M=b.phase===`creating-worktree`;let i;t[143]===_?i=t[144]:(i=_({id:`OuY8t9`}),t[143]=_,t[144]=i),N=i;let a;t[145]===_?a=t[146]:(a=_({id:`XZkdtg`}),t[145]=_,t[146]=a),P=a;let o;t[147]===_?o=t[148]:(o=_({id:`VTulZj`}),t[147]=_,t[148]=o),q=o;let s=b.phase===`loading`,ee=b.phase===`error`;j=ce,W=!0,t[149]===O?G=t[150]:(G=e=>{e||O()},t[149]=O,t[150]=G),A=ae,z=`sm:max-w-xl`,B=`share-branch-switch-dialog`,V=De,H=Ee;let l;t[151]===C?l=t[152]:(l=(0,v.jsx)(ie,{children:(0,v.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:C}})}),t[151]=C,t[152]=l);let te=w.owner,ne=w.repo,d;t[153]===w.target?d=t[154]:(d=c(w.target),t[153]=w.target,t[154]=d);let f;t[155]!==w.owner||t[156]!==w.repo||t[157]!==d?(f=(0,v.jsx)(re,{className:`sr-only`,children:(0,v.jsx)(r,{id:`f8jU-L`,values:{0:te,1:ne,2:d}})}),t[155]=w.owner,t[156]=w.repo,t[157]=d,t[158]=f):f=t[158],t[159]!==l||t[160]!==f?(U=(0,v.jsxs)(se,{children:[l,f]}),t[159]=l,t[160]=f,t[161]=U):U=t[161],k=oe;let p=w.owner,m=w.repo,h;t[162]===w.target?h=t[163]:(h=c(w.target),t[162]=w.target,t[163]=h),t[164]!==w.branch||t[165]!==w.owner||t[166]!==w.repo||t[167]!==w.target.kind||t[168]!==h?(I=(0,v.jsx)(`div`,{className:`mb-4`,children:(0,v.jsx)(le,{owner:p,repo:m,path:h,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=w.branch,t[165]=w.owner,t[166]=w.repo,t[167]=w.target.kind,t[168]=h,t[169]=I):I=t[169],L=b.phase===`branch-in-other-worktree`?(0,v.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,v.jsx)(`p`,{className:`leading-6`,children:(0,v.jsx)(r,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,v.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:b.otherWorktreePath})]}):b.phase===`verdict-pending`?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,v.jsx)(r,{id:`Uay5NL`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`renamed`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,v.jsx)(r,{id:`P0HC30`,values:{0:b.resolution.renamedTo,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`diverged`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,v.jsx)(r,{id:`kLv8d3`,values:{shareBranch:E,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):s?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`jerqF0`})]}):ee?(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,v.jsx)(r,{id:`w4hMYl`})}):K?.kind===`D`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`DTI-fp`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):K?.kind===`B`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`_902BE`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),R=K&&!K.switchEnabled&&K.conflictingFiles.length>0?(0,v.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,v.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,v.jsx)(r,{id:`n2lRue`})}),(0,v.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:K.conflictingFiles.map(Te)})]}):null,t[107]=_,t[108]=b.info,t[109]=b.otherWorktreePath,t[110]=b.phase,t[111]=b.resolution,t[112]=O,t[113]=Ze,t[114]=w.branch,t[115]=w.owner,t[116]=w.repo,t[117]=w.target,t[118]=E,t[119]=C,t[120]=k,t[121]=A,t[122]=j,t[123]=M,t[124]=N,t[125]=P,t[126]=F,t[127]=I,t[128]=L,t[129]=R,t[130]=z,t[131]=B,t[132]=V,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=q}else k=t[120],A=t[121],j=t[122],M=t[123],N=t[124],P=t[125],F=t[126],I=t[127],L=t[128],R=t[129],z=t[130],B=t[131],V=t[132],H=t[133],U=t[134],W=t[135],G=t[136],K=t[137],q=t[138];let J;t[170]===F?J=t[171]:(J=F?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=F,t[171]=J);let Y;t[172]===M?Y=t[173]:(Y=M?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=M,t[173]=Y);let X;t[174]!==k||t[175]!==I||t[176]!==L||t[177]!==R||t[178]!==J||t[179]!==Y?(X=(0,v.jsxs)(k,{children:[I,L,R,J,Y]}),t[174]=k,t[175]=I,t[176]=L,t[177]=R,t[178]=J,t[179]=Y,t[180]=X):X=t[180];let vt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,v.jsx)(r,{id:`dEgA5A`}),t[181]=vt):vt=t[181];let Z;t[182]===O?Z=t[183]:(Z=(0,v.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:O,"data-testid":`share-branch-switch-cancel`,children:vt}),t[182]=O,t[183]=Z);let Q;t[184]!==b.phase||t[185]!==b.resolution||t[186]!==M||t[187]!==ct||t[188]!==it||t[189]!==mt||t[190]!==gt||t[191]!==ot||t[192]!==et||t[193]!==nt||t[194]!==N||t[195]!==P||t[196]!==F||t[197]!==K||t[198]!==q?(Q=b.phase===`branch-in-other-worktree`?(0,v.jsx)(o,{onClick:gt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,v.jsx)(r,{id:`hyCxJY`})}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`uA_jXp`})]}):b.resolution.kind===`renamed`?(0,v.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`AItsE5`})]}):b.resolution.kind===`diverged`?(0,v.jsxs)(o,{onClick:ot,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),P]}):null:(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[K?.openCurrentEnabled?(0,v.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ct,disabled:F||M,"data-testid":`share-branch-switch-open-current`,children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),N]}):null,(0,v.jsx)(o,{variant:`outline`,onClick:et,disabled:!K?.switchEnabled||F||M,"aria-disabled":!K?.switchEnabled||F||M,"aria-describedby":K&&!K.switchEnabled&&K.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:F?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),P]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),P]})}),(0,v.jsx)(o,{onClick:mt,disabled:!K||F||M,"data-testid":`share-branch-switch-worktree`,children:M?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),q]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),q]})})]}),t[184]=b.phase,t[185]=b.resolution,t[186]=M,t[187]=ct,t[188]=it,t[189]=mt,t[190]=gt,t[191]=ot,t[192]=et,t[193]=nt,t[194]=N,t[195]=P,t[196]=F,t[197]=K,t[198]=q,t[199]=Q):Q=t[199];let yt;t[200]!==Z||t[201]!==Q?(yt=(0,v.jsxs)(d,{className:`sm:justify-between`,children:[Z,Q]}),t[200]=Z,t[201]=Q,t[202]=yt):yt=t[202];let $;t[203]!==A||t[204]!==z||t[205]!==B||t[206]!==V||t[207]!==H||t[208]!==U||t[209]!==X||t[210]!==yt?($=(0,v.jsxs)(A,{className:z,"data-testid":B,onInteractOutside:V,onPointerDownOutside:H,children:[U,X,yt]}),t[203]=A,t[204]=z,t[205]=B,t[206]=V,t[207]=H,t[208]=U,t[209]=X,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==j||t[213]!==W||t[214]!==G||t[215]!==$?(bt=(0,v.jsx)(j,{open:W,onOpenChange:G,children:$}),t[212]=j,t[213]=W,t[214]=G,t[215]=$,t[216]=bt):bt=t[216],bt}function Te(e){return(0,v.jsx)(`li`,{children:(0,v.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(){return p.request()}function ke(e){return be(e,null).state}function Ae(e){return ye(e,null)}function je(e){return me(e,null)}function Me(){return null}export{y as ShareBranchSwitchDialog};
|
package/dist/public/assets/{ShareReceiveDialog-C9KNKynH.js → ShareReceiveDialog-DmClGCLD.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{En as s,On as c}from"./dist-YRM6aCj22.js";import{n as l}from"./dist-DTX2HxC82.js";import{t as u}from"./desktop-bridge-types-rBjHIYSI.js";import{t as ee}from"./spinner-DmibE6UV.js";import{a as d,c as f,i as p,n as te,o as m,s as h,t as g}from"./dialog-DD-GTVf9.js";import{a as ne,i as _,n as v,o as y,r as re,s as b}from"./receive-store-D1fi7HMJ.js";import{t as ie}from"./share-metadata-rows-DPgPU-ev.js";var x=e(n(),1),S=a(),C=e=>({phase:`ready`,seed:e});function w(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function T(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function E(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function D(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var O=t();function k(e){return{kind:e.target.kind,path:u(e.target),repositoryPath:u(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function A(e){return e!==null&&e.kind===`launcher-consent`}function j(e){return e!==null&&e.kind===`launcher-miss`}function M(e){let t=(0,S.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?v:i,o=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot,P),[s,c]=(0,x.useState)(0),[u,ee]=(0,x.useState)(o);o!==u&&(ee(o),c(N));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=b(o);e&&(l.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,x.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=j(o)?o:null,t[4]=o,t[5]=p);let te=p,m;t[6]===o?m=t[7]:(m=A(o)?o:null,t[6]=o,t[7]=m);let h=m??te;if(!h)return null;let g;return t[8]!==h||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(g=(0,O.jsx)(F,{payload:h,bridge:n,cloneController:r,store:a},s),t[8]=h,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=g):g=t[13],g}function N(e){return e+1}function P(){return null}function F(e){let t=(0,S.c)(165),{payload:n,bridge:a,cloneController:v,store:b}=e,{_:w}=i(),[D,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,ue]=(0,x.useState)(!1),[I,de]=(0,x.useState)(!1),[L,fe]=(0,x.useState)(null),[R,z]=(0,x.useState)(null),pe=(0,x.useRef)(!1),me=(0,x.useRef)(null),he,ge;t[0]===L?(he=t[1],ge=t[2]):(he=()=>{L&&me.current?.focus()},ge=[L],t[0]=L,t[1]=he,t[2]=ge),(0,x.useEffect)(he,ge);let _e;t[3]!==R||t[4]!==n?(_e=()=>{A(n)&&R===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),z(C({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:u(n.share.target),targetKind:n.share.target.kind,repositoryPath:u(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=R,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,x.useEffect)(_e,ve);let ye;t[8]!==N||t[9]!==v||t[10]!==n?(ye=()=>{if(!v||!j(n)||N!==null||pe.current)return;pe.current=!0,ue(!0);let e=n.share.host;v.getAuthStatus(e).then(e=>{P(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),P({authenticated:!1,host:e})}).finally(()=>{ue(!1)})},t[8]=N,t[9]=v,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==N||t[13]!==n?(be=[n,N],t[12]=N,t[13]=n,t[14]=be):be=t[14],(0,x.useEffect)(ye,be);let B=j(n)?n:null,xe=A(n)?n:null,V=B?.share??xe?.share??null,H,Se,U,W,G,Ce,K,q;if(t[15]!==w||t[16]!==F||t[17]!==a||t[18]!==v||t[19]!==I||t[20]!==R||t[21]!==B||t[22]!==D||t[23]!==V||t[24]!==b){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V?{host:V.host,owner:V.owner,repo:V.repo}:null,n;t[33]!==w||t[34]!==V?.target.kind?(n=V?.target.kind===`folder`?w({id:`ugoTXs`}):w({id:`XH30C4`}),t[33]=w,t[34]=V?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!B||!e)return;if(console.log(ne({q2_path:`clone`})),!v){l.info(w({id:`27XW26`}),{action:{label:w({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(I)return;fe(null),de(!0);let t=re(e),n;try{n=await v.runClone({url:t,branch:B.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:k(B.share)}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(w({id:`438Fca`}))}return}};let i;t[36]!==w||t[37]!==F||t[38]!==v?(i=async function(){if(!(!v||F)){ue(!0);try{let e=await v.startSignIn();ue(!1),e!==null&&P(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(w({id:`lzwo7p`}))}}},t[36]=w,t[37]=F,t[38]=v,t[39]=i):i=t[39],G=i,W=async function(){if(!(!B||!e||D)){fe(null),M(!0),console.log(ne({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ne({folder_validate:n.kind})),n.kind===`ok`){let e=B.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=c(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:B.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:k(B.share)}}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(w({id:`phM8Kh`}))}break}let r=y(n,e);r&&l.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(w({id:`rlUzXK`}))}M(!1)}};let _;t[40]!==w||t[41]!==a||t[42]!==R||t[43]!==b?(_=function(){if(R===null||R.phase!==`ready`)return;let e=R.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),z(le),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){z(e=>e===null?e:T(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),z(ce),b.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);z(e=>e===null?e:E(e,{ok:!1,message:r})),l.error(w({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;z(e=>e===null?e:T(e,{ok:!1,reason:n,message:r})),l.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);z(e=>e===null?e:T(e,{ok:!1,reason:`network-error`,message:n})),l.error(w({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=w,t[41]=a,t[42]=R,t[43]=b,t[44]=_):_=t[44];let x=_,S;t[45]!==R||t[46]!==b?(S=function(){R!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${R.seed.candidatePath}`),z(se),b.dismiss()},t[45]=R,t[46]=b,t[47]=S):S=t[47];let C=S;if(R!==null&&R.phase!==`cancelled`&&R.phase!==`done`&&V!==null){let e=R.seed,n=R.phase===`initializing`||R.phase===`opening`,i;t[48]===C?i=t[49]:(i=e=>{e||C()},t[48]=C,t[49]=i);let a;t[50]===q?a=t[51]:(a=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let s;t[52]===V.target?s=t[53]:(s=u(V.target)?`— ${u(V.target)}`:``,t[52]=V.target,t[53]=s);let c;t[54]!==V.owner||t[55]!==V.repo||t[56]!==s?(c=(0,O.jsx)(d,{className:`sr-only`,children:(0,O.jsx)(r,{id:`pgq_xf`,values:{0:V.owner,1:V.repo,2:s}})}),t[54]=V.owner,t[55]=V.repo,t[56]=s,t[57]=c):c=t[57];let l=V.owner,ne=V.repo,_;t[58]===V.target?_=t[59]:(_=u(V.target),t[58]=V.target,t[59]=_);let v;t[60]!==V.branch||t[61]!==V.owner||t[62]!==V.repo||t[63]!==V.target.kind||t[64]!==_?(v=(0,O.jsx)(ie,{owner:l,repo:ne,path:_,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=V.branch,t[61]=V.owner,t[62]=V.repo,t[63]=V.target.kind,t[64]=_,t[65]=v):v=t[65];let y;t[66]!==a||t[67]!==c||t[68]!==v?(y=(0,O.jsxs)(h,{children:[a,c,v]}),t[66]=a,t[67]=c,t[68]=v,t[69]=y):y=t[69];let re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`KsAPaB`})}),t[70]=re):re=t[70];let b;t[71]===e.candidatePath?b=t[72]:(b=(0,O.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=b);let S;t[73]===e.parentProjectName?S=t[74]:(S=e.parentProjectName===null?null:(0,O.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,O.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=S);let w;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`w7SsvI`})}),t[75]=w):w=t[75];let T;t[76]!==R.message||t[77]!==R.phase?(T=R.phase===`error`?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:R.message}):null,t[76]=R.message,t[77]=R.phase,t[78]=T):T=t[78];let E;t[79]!==b||t[80]!==S||t[81]!==T?(E=(0,O.jsxs)(te,{children:[re,b,S,w,T]}),t[79]=b,t[80]=S,t[81]=T,t[82]=E):E=t[82];let D;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(r,{id:`dEgA5A`}),t[83]=D):D=t[83];let k;t[84]===C?k=t[85]:(k=(0,O.jsx)(o,{variant:`ghost`,onClick:C,"data-testid":`share-receive-consent-cancel`,children:D}),t[84]=C,t[85]=k);let A=n||R.phase===`error`,j=n||R.phase===`error`,M;t[86]===n?M=t[87]:(M=n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ee,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,O.jsx)(r,{id:`NKkZXl`})]}):(0,O.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=M);let N;t[88]!==x||t[89]!==A||t[90]!==j||t[91]!==M?(N=(0,O.jsx)(o,{onClick:x,disabled:A,"aria-disabled":j,"data-testid":`share-receive-consent-initialize`,children:M}),t[88]=x,t[89]=A,t[90]=j,t[91]=M,t[92]=N):N=t[92];let P;t[93]!==k||t[94]!==N?(P=(0,O.jsxs)(m,{children:[k,N]}),t[93]=k,t[94]=N,t[95]=P):P=t[95];let F;t[96]!==y||t[97]!==E||t[98]!==P?(F=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:oe,onPointerDownOutside:ae,children:[y,E,P]}),t[96]=y,t[97]=E,t[98]=P,t[99]=F):F=t[99];let se;t[100]!==i||t[101]!==F?(se=(0,O.jsx)(g,{open:!0,onOpenChange:i,children:F}),t[100]=i,t[101]=F,t[102]=se):se=t[102],K=se;break bb0}if(!B||!V||!e){K=null;break bb0}H=v!==void 0&&!I;let A;t[103]!==w||t[104]!==I?(A=w(I?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=w,t[104]=I,t[105]=A):A=t[105],Se=A,Ce=s(e)}t[15]=w,t[16]=F,t[17]=a,t[18]=v,t[19]=I,t[20]=R,t[21]=B,t[22]=D,t[23]=V,t[24]=b,t[25]=H,t[26]=Se,t[27]=U,t[28]=W,t[29]=G,t[30]=Ce,t[31]=K,t[32]=q}else H=t[25],Se=t[26],U=t[27],W=t[28],G=t[29],Ce=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let we=Ce,Te=N?.authenticated?N.login:void 0,Ee;t[106]===L?Ee=t[107]:(Ee=L?.detail?_(L.detail):``,t[106]=L,t[107]=Ee);let De=Ee,J;t[108]===b?J=t[109]:(J=e=>{e||b.dismiss()},t[108]=b,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===V.target?X=t[113]:(X=u(V.target)?` — ${u(V.target)}`:null,t[112]=V.target,t[113]=X);let Z;t[114]!==V.owner||t[115]!==V.repo||t[116]!==X?(Z=(0,O.jsxs)(d,{className:`sr-only`,children:[V.owner,`/`,V.repo,X]}),t[114]=V.owner,t[115]=V.repo,t[116]=X,t[117]=Z):Z=t[117];let Oe=V.owner,ke=V.repo,Q;t[118]===V.target?Q=t[119]:(Q=u(V.target),t[118]=V.target,t[119]=Q);let Ae;t[120]!==V.branch||t[121]!==V.owner||t[122]!==V.repo||t[123]!==V.target.kind||t[124]!==Q?(Ae=(0,O.jsx)(ie,{owner:Oe,repo:ke,path:Q,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=V.branch,t[121]=V.owner,t[122]=V.repo,t[123]=V.target.kind,t[124]=Q,t[125]=Ae):Ae=t[125];let je;t[126]!==Y||t[127]!==Z||t[128]!==Ae?(je=(0,O.jsxs)(h,{children:[Y,Z,Ae]}),t[126]=Y,t[127]=Z,t[128]=Ae,t[129]=je):je=t[129];let Me;t[130]!==v||t[131]!==H||t[132]!==L||t[133]!==De||t[134]!==Se||t[135]!==I||t[136]!==U||t[137]!==W||t[138]!==D?(Me=L?(0,O.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,O.jsx)(r,{id:`aiArms`})}),De?(0,O.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,O.jsx)(r,{id:`4BITzH`}),` `,(0,O.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,De,`"`]})]}):null,(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`Llyqvo`})}),(0,O.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`6LbUG7`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`_pY_Vq`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`J6mxC1`})})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,O.jsx)(o,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,O.jsx)(r,{id:`KDw4GX`})}),(0,O.jsx)(o,{variant:`outline`,onClick:()=>{W()},disabled:D||I,"data-testid":`share-receive-error-local`,children:(0,O.jsx)(r,{id:`xFQRu4`})})]})]}):(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:v!==void 0&&!H,"aria-disabled":v!==void 0&&!H,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:Se}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`fj5YiP`})})]}),(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:D||I,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,O.jsx)(r,{id:`HfI1dR`})}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=v,t[131]=H,t[132]=L,t[133]=De,t[134]=Se,t[135]=I,t[136]=U,t[137]=W,t[138]=D,t[139]=Me):Me=t[139];let Ne;t[140]!==F||t[141]!==N||t[142]!==v||t[143]!==G||t[144]!==Te?(Ne=v?(0,O.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:N===null?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`UDFrWm`})}):N.authenticated?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Te},components:{0:(0,O.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`SgKLfA`})}),(0,O.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:F,children:F?(0,O.jsx)(r,{id:`PKLY-1`}):(0,O.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=F,t[141]=N,t[142]=v,t[143]=G,t[144]=Te,t[145]=Ne):Ne=t[145];let Pe;t[146]!==L||t[147]!==we?(Pe=L?null:(0,O.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:we},components:{0:(0,O.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=L,t[147]=we,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Me||t[150]!==Ne||t[151]!==Pe?(Fe=(0,O.jsxs)(te,{children:[Me,Ne,Pe]}),t[149]=Me,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===b?Ie=t[154]:(Ie=()=>b.dismiss(),t[153]=b,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,O.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,O.jsx)(m,{children:(0,O.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==je||t[159]!==Fe||t[160]!==Re?($=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[je,Fe,Re]}),t[158]=je,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==J||t[163]!==$?(ze=(0,O.jsx)(g,{open:!0,onOpenChange:J,children:$}),t[162]=J,t[163]=$,t[164]=ze):ze=t[164],ze}function ae(e){return e.preventDefault()}function oe(e){return e.preventDefault()}function se(e){return e===null?e:D(e)}function ce(e){return e===null?e:E(e,{ok:!0})}function le(e){return e===null?e:w(e)}export{M as ShareReceiveDialog};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{En as s,On as c}from"./dist-DKOit9IV2.js";import{n as l}from"./dist-DTX2HxC82.js";import{t as u}from"./desktop-bridge-types-rBjHIYSI.js";import{t as ee}from"./spinner-DmibE6UV.js";import{a as d,c as f,i as p,n as te,o as m,s as h,t as g}from"./dialog-DD-GTVf9.js";import{a as ne,i as _,n as v,o as y,r as re,s as b}from"./receive-store-DFDJ0T_F.js";import{t as ie}from"./share-metadata-rows-DPgPU-ev.js";var x=e(n(),1),S=a(),C=e=>({phase:`ready`,seed:e});function w(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function T(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function E(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function D(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var O=t();function k(e){return{kind:e.target.kind,path:u(e.target),repositoryPath:u(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function A(e){return e!==null&&e.kind===`launcher-consent`}function j(e){return e!==null&&e.kind===`launcher-miss`}function M(e){let t=(0,S.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?v:i,o=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot,P),[s,c]=(0,x.useState)(0),[u,ee]=(0,x.useState)(o);o!==u&&(ee(o),c(N));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=b(o);e&&(l.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,x.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=j(o)?o:null,t[4]=o,t[5]=p);let te=p,m;t[6]===o?m=t[7]:(m=A(o)?o:null,t[6]=o,t[7]=m);let h=m??te;if(!h)return null;let g;return t[8]!==h||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(g=(0,O.jsx)(F,{payload:h,bridge:n,cloneController:r,store:a},s),t[8]=h,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=g):g=t[13],g}function N(e){return e+1}function P(){return null}function F(e){let t=(0,S.c)(165),{payload:n,bridge:a,cloneController:v,store:b}=e,{_:w}=i(),[D,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,ue]=(0,x.useState)(!1),[I,de]=(0,x.useState)(!1),[L,fe]=(0,x.useState)(null),[R,z]=(0,x.useState)(null),pe=(0,x.useRef)(!1),me=(0,x.useRef)(null),he,ge;t[0]===L?(he=t[1],ge=t[2]):(he=()=>{L&&me.current?.focus()},ge=[L],t[0]=L,t[1]=he,t[2]=ge),(0,x.useEffect)(he,ge);let _e;t[3]!==R||t[4]!==n?(_e=()=>{A(n)&&R===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),z(C({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:u(n.share.target),targetKind:n.share.target.kind,repositoryPath:u(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=R,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,x.useEffect)(_e,ve);let ye;t[8]!==N||t[9]!==v||t[10]!==n?(ye=()=>{if(!v||!j(n)||N!==null||pe.current)return;pe.current=!0,ue(!0);let e=n.share.host;v.getAuthStatus(e).then(e=>{P(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),P({authenticated:!1,host:e})}).finally(()=>{ue(!1)})},t[8]=N,t[9]=v,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==N||t[13]!==n?(be=[n,N],t[12]=N,t[13]=n,t[14]=be):be=t[14],(0,x.useEffect)(ye,be);let B=j(n)?n:null,xe=A(n)?n:null,V=B?.share??xe?.share??null,H,Se,U,W,G,Ce,K,q;if(t[15]!==w||t[16]!==F||t[17]!==a||t[18]!==v||t[19]!==I||t[20]!==R||t[21]!==B||t[22]!==D||t[23]!==V||t[24]!==b){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V?{host:V.host,owner:V.owner,repo:V.repo}:null,n;t[33]!==w||t[34]!==V?.target.kind?(n=V?.target.kind===`folder`?w({id:`ugoTXs`}):w({id:`XH30C4`}),t[33]=w,t[34]=V?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!B||!e)return;if(console.log(ne({q2_path:`clone`})),!v){l.info(w({id:`27XW26`}),{action:{label:w({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(I)return;fe(null),de(!0);let t=re(e),n;try{n=await v.runClone({url:t,branch:B.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:k(B.share)}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(w({id:`438Fca`}))}return}};let i;t[36]!==w||t[37]!==F||t[38]!==v?(i=async function(){if(!(!v||F)){ue(!0);try{let e=await v.startSignIn();ue(!1),e!==null&&P(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(w({id:`lzwo7p`}))}}},t[36]=w,t[37]=F,t[38]=v,t[39]=i):i=t[39],G=i,W=async function(){if(!(!B||!e||D)){fe(null),M(!0),console.log(ne({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ne({folder_validate:n.kind})),n.kind===`ok`){let e=B.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=c(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:B.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:k(B.share)}}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(w({id:`phM8Kh`}))}break}let r=y(n,e);r&&l.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(w({id:`rlUzXK`}))}M(!1)}};let _;t[40]!==w||t[41]!==a||t[42]!==R||t[43]!==b?(_=function(){if(R===null||R.phase!==`ready`)return;let e=R.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),z(le),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){z(e=>e===null?e:T(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),z(ce),b.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);z(e=>e===null?e:E(e,{ok:!1,message:r})),l.error(w({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;z(e=>e===null?e:T(e,{ok:!1,reason:n,message:r})),l.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);z(e=>e===null?e:T(e,{ok:!1,reason:`network-error`,message:n})),l.error(w({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=w,t[41]=a,t[42]=R,t[43]=b,t[44]=_):_=t[44];let x=_,S;t[45]!==R||t[46]!==b?(S=function(){R!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${R.seed.candidatePath}`),z(se),b.dismiss()},t[45]=R,t[46]=b,t[47]=S):S=t[47];let C=S;if(R!==null&&R.phase!==`cancelled`&&R.phase!==`done`&&V!==null){let e=R.seed,n=R.phase===`initializing`||R.phase===`opening`,i;t[48]===C?i=t[49]:(i=e=>{e||C()},t[48]=C,t[49]=i);let a;t[50]===q?a=t[51]:(a=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let s;t[52]===V.target?s=t[53]:(s=u(V.target)?`— ${u(V.target)}`:``,t[52]=V.target,t[53]=s);let c;t[54]!==V.owner||t[55]!==V.repo||t[56]!==s?(c=(0,O.jsx)(d,{className:`sr-only`,children:(0,O.jsx)(r,{id:`pgq_xf`,values:{0:V.owner,1:V.repo,2:s}})}),t[54]=V.owner,t[55]=V.repo,t[56]=s,t[57]=c):c=t[57];let l=V.owner,ne=V.repo,_;t[58]===V.target?_=t[59]:(_=u(V.target),t[58]=V.target,t[59]=_);let v;t[60]!==V.branch||t[61]!==V.owner||t[62]!==V.repo||t[63]!==V.target.kind||t[64]!==_?(v=(0,O.jsx)(ie,{owner:l,repo:ne,path:_,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=V.branch,t[61]=V.owner,t[62]=V.repo,t[63]=V.target.kind,t[64]=_,t[65]=v):v=t[65];let y;t[66]!==a||t[67]!==c||t[68]!==v?(y=(0,O.jsxs)(h,{children:[a,c,v]}),t[66]=a,t[67]=c,t[68]=v,t[69]=y):y=t[69];let re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`KsAPaB`})}),t[70]=re):re=t[70];let b;t[71]===e.candidatePath?b=t[72]:(b=(0,O.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=b);let S;t[73]===e.parentProjectName?S=t[74]:(S=e.parentProjectName===null?null:(0,O.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,O.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=S);let w;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`w7SsvI`})}),t[75]=w):w=t[75];let T;t[76]!==R.message||t[77]!==R.phase?(T=R.phase===`error`?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:R.message}):null,t[76]=R.message,t[77]=R.phase,t[78]=T):T=t[78];let E;t[79]!==b||t[80]!==S||t[81]!==T?(E=(0,O.jsxs)(te,{children:[re,b,S,w,T]}),t[79]=b,t[80]=S,t[81]=T,t[82]=E):E=t[82];let D;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(r,{id:`dEgA5A`}),t[83]=D):D=t[83];let k;t[84]===C?k=t[85]:(k=(0,O.jsx)(o,{variant:`ghost`,onClick:C,"data-testid":`share-receive-consent-cancel`,children:D}),t[84]=C,t[85]=k);let A=n||R.phase===`error`,j=n||R.phase===`error`,M;t[86]===n?M=t[87]:(M=n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ee,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,O.jsx)(r,{id:`NKkZXl`})]}):(0,O.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=M);let N;t[88]!==x||t[89]!==A||t[90]!==j||t[91]!==M?(N=(0,O.jsx)(o,{onClick:x,disabled:A,"aria-disabled":j,"data-testid":`share-receive-consent-initialize`,children:M}),t[88]=x,t[89]=A,t[90]=j,t[91]=M,t[92]=N):N=t[92];let P;t[93]!==k||t[94]!==N?(P=(0,O.jsxs)(m,{children:[k,N]}),t[93]=k,t[94]=N,t[95]=P):P=t[95];let F;t[96]!==y||t[97]!==E||t[98]!==P?(F=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:oe,onPointerDownOutside:ae,children:[y,E,P]}),t[96]=y,t[97]=E,t[98]=P,t[99]=F):F=t[99];let se;t[100]!==i||t[101]!==F?(se=(0,O.jsx)(g,{open:!0,onOpenChange:i,children:F}),t[100]=i,t[101]=F,t[102]=se):se=t[102],K=se;break bb0}if(!B||!V||!e){K=null;break bb0}H=v!==void 0&&!I;let A;t[103]!==w||t[104]!==I?(A=w(I?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=w,t[104]=I,t[105]=A):A=t[105],Se=A,Ce=s(e)}t[15]=w,t[16]=F,t[17]=a,t[18]=v,t[19]=I,t[20]=R,t[21]=B,t[22]=D,t[23]=V,t[24]=b,t[25]=H,t[26]=Se,t[27]=U,t[28]=W,t[29]=G,t[30]=Ce,t[31]=K,t[32]=q}else H=t[25],Se=t[26],U=t[27],W=t[28],G=t[29],Ce=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let we=Ce,Te=N?.authenticated?N.login:void 0,Ee;t[106]===L?Ee=t[107]:(Ee=L?.detail?_(L.detail):``,t[106]=L,t[107]=Ee);let De=Ee,J;t[108]===b?J=t[109]:(J=e=>{e||b.dismiss()},t[108]=b,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===V.target?X=t[113]:(X=u(V.target)?` — ${u(V.target)}`:null,t[112]=V.target,t[113]=X);let Z;t[114]!==V.owner||t[115]!==V.repo||t[116]!==X?(Z=(0,O.jsxs)(d,{className:`sr-only`,children:[V.owner,`/`,V.repo,X]}),t[114]=V.owner,t[115]=V.repo,t[116]=X,t[117]=Z):Z=t[117];let Oe=V.owner,ke=V.repo,Q;t[118]===V.target?Q=t[119]:(Q=u(V.target),t[118]=V.target,t[119]=Q);let Ae;t[120]!==V.branch||t[121]!==V.owner||t[122]!==V.repo||t[123]!==V.target.kind||t[124]!==Q?(Ae=(0,O.jsx)(ie,{owner:Oe,repo:ke,path:Q,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=V.branch,t[121]=V.owner,t[122]=V.repo,t[123]=V.target.kind,t[124]=Q,t[125]=Ae):Ae=t[125];let je;t[126]!==Y||t[127]!==Z||t[128]!==Ae?(je=(0,O.jsxs)(h,{children:[Y,Z,Ae]}),t[126]=Y,t[127]=Z,t[128]=Ae,t[129]=je):je=t[129];let Me;t[130]!==v||t[131]!==H||t[132]!==L||t[133]!==De||t[134]!==Se||t[135]!==I||t[136]!==U||t[137]!==W||t[138]!==D?(Me=L?(0,O.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,O.jsx)(r,{id:`aiArms`})}),De?(0,O.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,O.jsx)(r,{id:`4BITzH`}),` `,(0,O.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,De,`"`]})]}):null,(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`Llyqvo`})}),(0,O.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`6LbUG7`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`_pY_Vq`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`J6mxC1`})})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,O.jsx)(o,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,O.jsx)(r,{id:`KDw4GX`})}),(0,O.jsx)(o,{variant:`outline`,onClick:()=>{W()},disabled:D||I,"data-testid":`share-receive-error-local`,children:(0,O.jsx)(r,{id:`xFQRu4`})})]})]}):(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:v!==void 0&&!H,"aria-disabled":v!==void 0&&!H,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:Se}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`fj5YiP`})})]}),(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:D||I,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,O.jsx)(r,{id:`HfI1dR`})}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=v,t[131]=H,t[132]=L,t[133]=De,t[134]=Se,t[135]=I,t[136]=U,t[137]=W,t[138]=D,t[139]=Me):Me=t[139];let Ne;t[140]!==F||t[141]!==N||t[142]!==v||t[143]!==G||t[144]!==Te?(Ne=v?(0,O.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:N===null?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`UDFrWm`})}):N.authenticated?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Te},components:{0:(0,O.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`SgKLfA`})}),(0,O.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:F,children:F?(0,O.jsx)(r,{id:`PKLY-1`}):(0,O.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=F,t[141]=N,t[142]=v,t[143]=G,t[144]=Te,t[145]=Ne):Ne=t[145];let Pe;t[146]!==L||t[147]!==we?(Pe=L?null:(0,O.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:we},components:{0:(0,O.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=L,t[147]=we,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Me||t[150]!==Ne||t[151]!==Pe?(Fe=(0,O.jsxs)(te,{children:[Me,Ne,Pe]}),t[149]=Me,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===b?Ie=t[154]:(Ie=()=>b.dismiss(),t[153]=b,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,O.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,O.jsx)(m,{children:(0,O.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==je||t[159]!==Fe||t[160]!==Re?($=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[je,Fe,Re]}),t[158]=je,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==J||t[163]!==$?(ze=(0,O.jsx)(g,{open:!0,onOpenChange:J,children:$}),t[162]=J,t[163]=$,t[164]=ze):ze=t[164],ze}function ae(e){return e.preventDefault()}function oe(e){return e.preventDefault()}function se(e){return e===null?e:D(e)}function ce(e){return e===null?e:E(e,{ok:!0})}function le(e){return e===null?e:w(e)}export{M as ShareReceiveDialog};
|
package/dist/public/assets/{ShareReceiveMissDialog-CwqxBbfk.js → ShareReceiveMissDialog-DAxO28Lj.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-fsDdvtOj.js";import{t as l}from"./miss-dialog-store-CdkrAlK3.js";import{f as u,p as d}from"./doc-paths-DqOWEocR.js";import{c as f,i as p,n as m,s as h,t as g}from"./dialog-DD-GTVf9.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=d(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?d(e):u(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(h,{children:(0,y.jsx)(f,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(m,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(g,{open:!0,onOpenChange:D,children:(0,y.jsxs)(p,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{ut as i}from"./dist-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{ut as i}from"./dist-DKOit9IV2.js";import{t as a}from"./triangle-alert-CJVfCxE0.js";var o=r(),s=e();function c(e){return e<1e3?`~${e}`:`~${Math.round(e/100)/10}k`}function l(e){let t=(0,o.c)(15),{tokens:r,budget:i}=e,{_:l}=n(),u=i!==void 0&&r>i,d,f,p,m;if(t[0]!==l||t[1]!==i||t[2]!==u||t[3]!==r){let e=i===void 0?``:c(i);d=u||void 0,f=u?`text-amber-600 dark:text-amber-500`:void 0,t[8]===r?p=t[9]:(p=c(r),t[8]=r,t[9]=p),m=u?(0,s.jsx)(`span`,{role:`img`,"aria-label":l({id:`nem6R7`,values:{budgetLabel:e}}),children:(0,s.jsx)(a,{className:`ms-0.5 inline size-3 align-[-0.1em]`,"aria-hidden":`true`})}):null,t[0]=l,t[1]=i,t[2]=u,t[3]=r,t[4]=d,t[5]=f,t[6]=p,t[7]=m}else d=t[4],f=t[5],p=t[6],m=t[7];let h;return t[10]!==d||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,s.jsxs)(`span`,{"data-over-budget":d,className:f,children:[p,m]}),t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function u(e){let n=(0,o.c)(13),{size:r,omitOnDemand:a}=e,c;n[0]===r.alwaysOn?c=n[1]:(c=(0,s.jsx)(l,{tokens:r.alwaysOn,budget:100}),n[0]=r.alwaysOn,n[1]=c);let u;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,s.jsx)(t,{id:`DBqxw2`}),n[2]=u):u=n[2];let d;n[3]===r.onTrigger?d=n[4]:(d=(0,s.jsx)(l,{tokens:r.onTrigger,budget:i}),n[3]=r.onTrigger,n[4]=d);let f;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(t,{id:`ac8G0O`}),n[5]=f):f=n[5];let p;n[6]!==a||n[7]!==r.onDemand?(p=a?null:(0,s.jsxs)(s.Fragment,{children:[` · `,(0,s.jsx)(l,{tokens:r.onDemand}),` `,(0,s.jsx)(t,{id:`QnnKlV`})]}),n[6]=a,n[7]=r.onDemand,n[8]=p):p=n[8];let m;return n[9]!==c||n[10]!==d||n[11]!==p?(m=(0,s.jsxs)(`span`,{"data-testid":`skill-cost-value`,className:`font-mono text-[13px] text-muted-foreground`,children:[c,` `,u,` · `,d,` `,f,p]}),n[9]=c,n[10]=d,n[11]=p,n[12]=m):m=n[12],m}export{c as n,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./square-pen-BlKNuUz7.js";import{o as i}from"./skill-scope-
|
|
1
|
+
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./square-pen-BlKNuUz7.js";import{o as i}from"./skill-scope-C_bc3f6T.js";import{t as a}from"./SkillModeBanner-BRFTW7Zd.js";var o=n(),s=e();function c(e){let n=(0,o.c)(7),{name:c}=e,l;n[0]===c?l=n[1]:(l=i(c),n[0]=c,n[1]=l);let u;n[2]===l?u=n[3]:(u=(0,s.jsx)(`strong`,{className:`font-medium text-foreground`,children:l}),n[2]=l,n[3]=u);let d=u,f;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(r,{className:`size-4`,"aria-hidden":!0}),n[4]=f):f=n[4];let p;return n[5]===d?p=n[6]:(p=(0,s.jsx)(a,{icon:f,children:(0,s.jsx)(t,{id:`i-wHEp`,values:{boldName:d}})}),n[5]=d,n[6]=p),p}export{c as SkillEditBanner};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Nn as n}from"./DocumentContext-BrlDlUx7.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./utils-CPqDy6Hr.js";import{t as c}from"./mascot-outline-CtS592mc.js";import{t as l}from"./button-CA0dewJJ.js";import{i as u,n as d,t as f}from"./tooltip-DPvMEqsq.js";import{a as p,c as m,i as h,l as g,o as _,r as v,s as y}from"./alert-dialog-ZBAB0rfs.js";import{c as b,d as x,f as S,l as C,m as w,o as T,p as E,r as D,u as O,w as k}from"./terminal-cli-display-MwCkMfQx.js";import{a as A,d as j,f as M,i as N,n as P,o as F,p as I,u as L}from"./dropdown-menu-DRIarAms.js";import{$r as R,Kt as z,oo as B}from"./dist-YRM6aCj22.js";import{n as ee}from"./dist-DTX2HxC82.js";import{s as V}from"./documents-events-Dh2E-mNH.js";import{t as H}from"./createLucideIcon-CAkY8Blx.js";import{o as te}from"./use-open-skill-CLhiKLe2.js";import{t as U}from"./spinner-DmibE6UV.js";import{c as ne,n as re,r as W}from"./skill-scope-TpOVvXXj.js";import{A as G,F as K,M as ie,S as ae,x as q}from"./skills-api-Ci4vZCl_.js";var J=t(),Y=e(r(),1),X=o(),oe=3100,se=3;function ce(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??se;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var le={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},ue=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function de(e,t={}){let n=t.rng??Math.random,r=t.colors??ue,i=le[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var fe=1.8,pe=90,me=16,he=380,ge=.025,_e=.1,ve=.18,ye=400,be=9.2736,xe=18.1799,Se=14.5244,Ce={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function we(e,t){let{halfWidth:n,apexLift:r}=Ce[t];return`M${e-n} ${Se+.3} Q${e} ${Se-r}, ${e+n} ${Se+.3}`}function Te(e){let t=1.5,n=.3;return`M${e-t} ${Se-n} Q${e} ${Se+1.4}, ${e+t} ${Se-n}`}var Ee=15,De=15;function Oe(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function ke(e){let t=(0,X.c)(73),{size:n,className:r,style:i,trackMouse:a,variant:o,celebrateSignal:l,onRage:u}=e,d=n===void 0?48:n,f=a===void 0?!0:a,p=o===void 0?`default`:o,m=l===void 0?0:l,h=(0,Y.useRef)(null),g=(0,Y.useRef)(null),_=(0,Y.useRef)(null),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={x:0,y:0},t[0]=v):v=t[0];let y=(0,Y.useRef)(v),[b,x]=(0,Y.useState)(0),[S,C]=(0,Y.useState)(0),[w,T]=(0,Y.useState)(0),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[1]=E):E=t[1];let[D,O]=(0,Y.useState)(E),k=(0,Y.useRef)(0),A=(0,Y.useRef)(0),j=(0,Y.useRef)(void 0),M=p===`sleeping`,N;t[2]!==b||t[3]!==M||t[4]!==u?(N=function(){if(M)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=A.current===0?1/0:e-A.current;A.current=e;let n=ce(b,t),r=b===3&&e-k.current<3100,i=n===3&&r;n===3&&u?.(),x(n),C(Fe),i||(O(de(n)),n===3&&(k.current=e,T(Pe))),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},oe)},t[2]=b,t[3]=M,t[4]=u,t[5]=N):N=t[5];let P=N,F,I;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>()=>clearTimeout(j.current),I=[],t[6]=F,t[7]=I):(F=t[6],I=t[7]),(0,Y.useEffect)(F,I);let L,R;t[8]!==m||t[9]!==M?(L=()=>{m===0||M||(x(3),C(Ne),O(de(3)),k.current=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),T(Me),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},oe))},R=[m,M],t[8]=m,t[9]=M,t[10]=L,t[11]=R):(L=t[10],R=t[11]),(0,Y.useEffect)(L,R);let z,B;t[12]!==M||t[13]!==f?(z=()=>{if(!f||M||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,c=function(){s===0&&(s=requestAnimationFrame(u))},l=function(r){e=r.clientX,t=r.clientY,n=!0,c()};function u(){s=0;let l=g.current,u=h.current;if(!l||!u){c();return}let d=n;n=!1;let f=l.getBoundingClientRect(),p=f.left+f.width/2,m=f.top+f.height*.48,v=e-p,b=t-m,x=Math.hypot(v,b),S=Math.max(-1,Math.min(1,v/he)),C=-Math.max(-1,Math.min(1,b/he))*me,w=S*me,T=0,E=0;if(x>=1){let e=Math.min(x/pe,1)*fe;T=v/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!d&&D)return;c(),r+=(C-r)*_e,i+=(w-i)*_e,u.style.transform=`perspective(${ye}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*ve,o+=(E-o)*ve;let O=i*ge,k=-r*ge,A=a+O,j=o+k;y.current.x=A,y.current.y=j,_.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,l,{passive:!0}),c(),()=>{document.removeEventListener(`mousemove`,l),s!==0&&cancelAnimationFrame(s),s=0,h.current&&(h.current.style.transform=``),y.current={x:0,y:0},_.current?.removeAttribute(`transform`)}},B=[f,M],t[12]=M,t[13]=f,t[14]=z,t[15]=B):(z=t[14],B=t[15]),(0,Y.useEffect)(z,B);let ee;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{let e=_.current;if(!e)return;let{x:t,y:n}=y.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=ee):ee=t[16],(0,Y.useLayoutEffect)(ee);let V=b>0,H=V?b:1,te=V?`ok-blob-clicked-${b}`:null,U;t[17]===r?U=t[18]:(U=s(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=U);let ne=M?`cursor-default`:`cursor-pointer`,re=`body-${S}`,W=M&&`ok-blob-sleeping`,G;t[19]!==te||t[20]!==W?(G=s(`ok-blob-group`,W,te),t[19]=te,t[20]=W,t[21]=G):G=t[21];let K;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,J.jsx)(`path`,{d:c,className:`ok-blob-body`}),t[22]=K):K=t[22];let ie=(V||M)&&`ok-blob-eye-hidden`,ae;t[23]===ie?ae=t[24]:(ae=s(`ok-blob-eye`,ie),t[23]=ie,t[24]=ae);let q;t[25]===ae?q=t[26]:(q=(0,J.jsx)(`ellipse`,{cx:be,cy:Se,rx:1.2722,ry:1.9083,className:ae}),t[25]=ae,t[26]=q);let se=(V||M)&&`ok-blob-eye-hidden`,le;t[27]===se?le=t[28]:(le=s(`ok-blob-eye ok-blob-eye-right`,se),t[27]=se,t[28]=le);let ue;t[29]===le?ue=t[30]:(ue=(0,J.jsx)(`ellipse`,{cx:xe,cy:Se,rx:1.2722,ry:1.9083,className:le}),t[29]=le,t[30]=ue);let Ce;t[31]===H?Ce=t[32]:(Ce=we(be,H),t[31]=H,t[32]=Ce);let Ee=(!V||M)&&`ok-blob-eye-hidden`,De;t[33]===Ee?De=t[34]:(De=s(`ok-blob-happy-eye`,Ee),t[33]=Ee,t[34]=De);let Oe;t[35]!==Ce||t[36]!==De?(Oe=(0,J.jsx)(`path`,{d:Ce,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:De}),t[35]=Ce,t[36]=De,t[37]=Oe):Oe=t[37];let ke;t[38]===H?ke=t[39]:(ke=we(xe,H),t[38]=H,t[39]=ke);let Ie=(!V||M)&&`ok-blob-eye-hidden`,Le;t[40]===Ie?Le=t[41]:(Le=s(`ok-blob-happy-eye`,Ie),t[40]=Ie,t[41]=Le);let Re;t[42]!==ke||t[43]!==Le?(Re=(0,J.jsx)(`path`,{d:ke,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:Le}),t[42]=ke,t[43]=Le,t[44]=Re):Re=t[44];let Z;t[45]===M?Z=t[46]:(Z=M?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`path`,{d:Te(be),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,J.jsx)(`path`,{d:Te(xe),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=M,t[46]=Z);let ze;t[47]!==q||t[48]!==ue||t[49]!==Oe||t[50]!==Re||t[51]!==Z?(ze=(0,J.jsxs)(`g`,{ref:_,children:[q,ue,Oe,Re,Z]}),t[47]=q,t[48]=ue,t[49]=Oe,t[50]=Re,t[51]=Z,t[52]=ze):ze=t[52];let Be;t[53]!==re||t[54]!==G||t[55]!==ze?(Be=(0,J.jsxs)(`g`,{className:G,children:[K,ze]},re),t[53]=re,t[54]=G,t[55]=ze,t[56]=Be):Be=t[56];let Ve;t[57]===M?Ve=t[58]:(Ve=M?(0,J.jsxs)(`g`,{children:[(0,J.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,J.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[57]=M,t[58]=Ve);let Q;t[59]!==w||t[60]!==D?(Q=D.length>0&&(0,J.jsx)(`g`,{"data-slot":`ok-blob-burst`,children:D.map(Ae)},`firework-${w}`),t[59]=w,t[60]=D,t[61]=Q):Q=t[61];let He;t[62]!==P||t[63]!==d||t[64]!==ne||t[65]!==Be||t[66]!==Ve||t[67]!==Q?(He=(0,J.jsxs)(`svg`,{ref:g,width:d,height:d,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:ne,"aria-hidden":`true`,onClick:P,onMouseDown:je,children:[Be,Ve,Q]}),t[62]=P,t[63]=d,t[64]=ne,t[65]=Be,t[66]=Ve,t[67]=Q,t[68]=He):He=t[68];let Ue;return t[69]!==i||t[70]!==U||t[71]!==He?(Ue=(0,J.jsx)(`span`,{ref:h,className:U,style:i,children:He}),t[69]=i,t[70]=U,t[71]=He,t[72]=Ue):Ue=t[72],Ue}function Ae(e){return(0,J.jsx)(`circle`,{cx:Ee+e.originDx,cy:De+e.originDy,r:e.size,className:`ok-blob-firework`,style:Oe(e)},e.id)}function je(e){return e.preventDefault()}function Me(e){return e+1}function Ne(e){return e+1}function Pe(e){return e+1}function Fe(e){return e+1}var Ie=H(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Le=H(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Re=H(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Z=[...new Set(k.flatMap(e=>e.schemes))];function ze(e,t){let n=t.now?.()??Date.now(),r={};for(let t of k){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Be(e){return ze({},e)}async function Ve(e){let t=e.schemes??Z,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Q=Object.fromEntries(Z.map(e=>[e,{installed:!1}]));async function He(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Q}if(!t.ok)return Q;let n;try{n=await t.json()}catch{return Q}if(typeof n!=`object`||!n||Array.isArray(n))return Q;let r=n,i={};for(let e of Z)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Ue(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function We(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Be({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=ze(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Ue(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function Ge(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Ke(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Ve({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>He({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function qe(){let e=(0,X.c)(5),[t,n]=(0,Y.useState)(Je),r=(0,Y.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=We(Ke());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Y.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Je(){return Be({isElectronHost:Ge(),now:Date.now})}var Ye=(0,Y.createContext)(null);function Xe(e){let t=(0,X.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,J.jsx)(Ye,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Ze(){return(0,Y.use)(Ye)}function Qe(e){return!(e instanceof Error)||e.name!==`NotAllowedError`?!1:/permission denied|permissions policy/i.test(e.message)}function $e(e){let t=globalThis.document;if(!t?.body||typeof t.createElement!=`function`||typeof t.execCommand!=`function`)return!1;let n=t.createElement(`textarea`);n.value=e,n.style.position=`fixed`,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`readonly`,``),t.body.appendChild(n);try{return n.focus(),n.select(),t.execCommand(`copy`)}catch{return!1}finally{n.remove()}}async function et(e){let t=globalThis.okDesktop?.clipboard;if(t&&typeof t.writeText==`function`){await t.writeText(e);return}let n=globalThis.navigator?.clipboard;if(n&&typeof n.writeText==`function`)try{await n.writeText(e);return}catch(t){if($e(e))return;throw t}if(!$e(e))throw Error(`clipboard API unavailable`)}function tt(e){let t=(0,X.c)(48),{itemName:n,isSubmitting:r,onDelete:o,customTitle:s,customDescription:c,customDetail:u,customConfirmLabel:d,customConfirmLabelBusy:f,children:b}=e,{_:x}=a(),S;t[0]!==x||t[1]!==n?(S=n??x({id:`L3CEC1`}),t[0]=x,t[1]=n,t[2]=S):S=t[2];let C=S,w;t[3]!==x||t[4]!==d?(w=d??x({id:`cnGeoo`}),t[3]=x,t[4]=d,t[5]=w):w=t[5];let T=w,E;t[6]!==x||t[7]!==d||t[8]!==f?(E=f??d??x({id:`s3caR3`}),t[6]=x,t[7]=d,t[8]=f,t[9]=E):E=t[9];let D=E,O;t[10]!==x||t[11]!==s||t[12]!==C?(O=s??x({id:`77SdEP`,values:{itemName:C}}),t[10]=x,t[11]=s,t[12]=C,t[13]=O):O=t[13];let k;t[14]===O?k=t[15]:(k=(0,J.jsx)(g,{children:O}),t[14]=O,t[15]=k);let A;t[16]!==x||t[17]!==c||t[18]!==C?(A=c??x({id:`16D5Zj`,values:{itemName:C}}),t[16]=x,t[17]=c,t[18]=C,t[19]=A):A=t[19];let j;t[20]===A?j=t[21]:(j=(0,J.jsx)(_,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===u?M=t[23]:(M=u?(0,J.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:u}):null,t[22]=u,t[23]=M);let N;t[24]!==k||t[25]!==j||t[26]!==M?(N=(0,J.jsxs)(m,{children:[k,j,M]}),t[24]=k,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]===b?P=t[29]:(P=b?(0,J.jsx)(v,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsx)(i,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===r?I=t[32]:(I=(0,J.jsx)(h,{disabled:r,children:F}),t[31]=r,t[32]=I);let L;t[33]!==T||t[34]!==D||t[35]!==r?(L=r?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{"aria-hidden":`true`,className:`size-4`}),` `,D]}):T,t[33]=T,t[34]=D,t[35]=r,t[36]=L):L=t[36];let R;t[37]!==r||t[38]!==o||t[39]!==L?(R=(0,J.jsx)(l,{variant:`destructive`,onClick:o,disabled:r,children:L}),t[37]=r,t[38]=o,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==I||t[42]!==R?(z=(0,J.jsxs)(y,{children:[I,R]}),t[41]=I,t[42]=R,t[43]=z):z=t[43];let B;return t[44]!==P||t[45]!==z||t[46]!==N?(B=(0,J.jsxs)(p,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function nt(e){return e===`agents`||e===`.agents`||e.startsWith(`.agents/`)?`.agents`:e.includes(`/`)?e:B[e]??e}function rt(e){return e===`claude`?`claude-code`:e}function it(e){let t=(0,X.c)(18),r,i;if(t[0]===e?(r=t[1],i=t[2]):({host:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`agents`){let e;return t[3]===i?e=t[4]:(e=(0,J.jsx)(n,{...i}),t[3]=i,t[4]=e),e}if(r.includes(`/`)){if(r===`.agents`||r.startsWith(`.agents/`)){let e;return t[5]===i?e=t[6]:(e=(0,J.jsx)(n,{...i}),t[5]=i,t[6]=e),e}if(r===`.ok`||r.startsWith(`.ok/`)){let e;if(t[7]!==i){let{className:n,...r}=i;e=r,t[7]=i,t[8]=e}else e=t[8];let n=e,r;return t[9]===n?r=t[10]:(r=(0,J.jsx)(ke,{size:14,...n}),t[9]=n,t[10]=r),r}let e;return t[11]===i?e=t[12]:(e=(0,J.jsx)(te,{...i}),t[11]=i,t[12]=e),e}let a;t[13]===r?a=t[14]:(a=rt(r),t[13]=r,t[14]=a);let o;return t[15]!==i||t[16]!==a?(o=(0,J.jsx)(D,{...i,id:a}),t[15]=i,t[16]=a,t[17]=o):o=t[17],o}function at(e){let t=(0,X.c)(14),{hosts:n,className:r,iconClassName:i}=e,a,o,c;if(t[0]!==r||t[1]!==n||t[2]!==i){let e=n.slice(0,2),l=n.slice(2);t[6]===r?a=t[7]:(a=s(`flex items-center gap-1`,r),t[6]=r,t[7]=a);let p;t[8]===i?p=t[9]:(p=e=>(0,J.jsxs)(f,{children:[(0,J.jsx)(u,{asChild:!0,children:(0,J.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,J.jsx)(it,{host:e,className:s(`size-3.5 shrink-0`,i),"aria-label":nt(e)})})}),(0,J.jsx)(d,{children:nt(e)})]},e),t[8]=i,t[9]=p),o=e.map(p),c=l.length>0?(0,J.jsxs)(f,{children:[(0,J.jsx)(u,{asChild:!0,children:(0,J.jsxs)(`span`,{className:`ml-0.5 cursor-default`,children:[`+`,l.length]})}),(0,J.jsx)(d,{children:l.map(nt).join(`, `)})]}):null,t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=c}else a=t[3],o=t[4],c=t[5];let l;return t[10]!==a||t[11]!==o||t[12]!==c?(l=(0,J.jsxs)(`span`,{className:a,children:[o,c]}),t[10]=a,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function ot(e){let t=(0,X.c)(6),{testId:n,title:r}=e,a;t[0]===r?a=t[1]:(a=r===void 0?{}:{title:r},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(i,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,J.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide`,"data-testid":n,...a,children:o}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s}function st(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(b,{...r}):(0,J.jsx)(N,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ct(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(C,{...r}):(0,J.jsx)(A,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function lt(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(T,{...r}):(0,J.jsx)(P,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ut(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(O,{...r}):(0,J.jsx)(F,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function dt(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(x,{...r}):(0,J.jsx)(L,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ft(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(S,{...r}):(0,J.jsx)(j,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function pt(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(E,{...r}):(0,J.jsx)(M,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function mt(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(w,{...r}):(0,J.jsx)(I,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var ht=Object.freeze({hosts:null,source:null}),gt=new Map,_t=new Map;function vt(e,t){return`${e}:${t}`}function yt(e){return gt.get(e)??ht}function bt(e,t){let n=_t.get(e)??new Set;return _t.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&_t.delete(e)}}function xt(e,t){let n=yt(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?gt.delete(e):gt.set(e,r);for(let t of _t.get(e)??[])t()}}var St=z.options,Ct=`.agents/`;function wt({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${ne(t,e.scope)}/${e.name}`:null,o=e!==void 0&&((e.hosts??[]).includes(`agents`)||t?.some(e=>e.hosts.includes(`agents`)||e.path.startsWith(Ct))),s=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),c=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),l=c?new Set(c):null,u=(o?[...St,`agents`]:St).filter(e=>!(e in s)).filter(e=>e===`agents`||l===null||l.has(e)||n.has(e)),d=new Set(u.map(e=>a(e))),f=e?.scope===`global`?`~/`:``,p=e?.path?.includes(`/`)?`${f}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,m=p!==null&&!d.has(p)?p:null,h=m===null?r??e?.hosts?.[0]:void 0,g=new Set(e?.conflictHosts??[]),_=new Set(e?.driftPaths??[]),v=new Set(e?.symlinkedHosts??[]),y=[...[...n].filter(e=>e!==h&&!(e in s)&&!g.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:v.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:W(e),display:`${f}${e.path}`,mode:e.mode}))],b=y.map(e=>e.mode),x=b.filter(e=>e===`link`).length,S=b.length===0?i?`link`:`copy`:x*2>=b.length?`link`:`copy`,C=new Map((e?.customPlacements??[]).map(e=>[W(e),e])),w=new Set(C.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=W(e);t!==``&&w.add(t)}}return{pathFor:a,aliases:s,rows:u,sourceRow:m,sourceHost:h,conflicted:g,drifted:_,linked:v,expectedMode:S,convertible:y,customRootRows:e===void 0?[]:[...w].sort().map(t=>({root:t,display:`${f}${t}/${e.name}`,placed:C.get(t)??null})).filter(e=>!d.has(e.display)&&e.display!==p&&!(e.root in s))}}var Tt=`min-w-[24rem]`;function Et(e,t){let n=(0,X.c)(45),r=t.installingName===e.name,i=(0,Y.useRef)(e),[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,Y.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,Y.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=vt(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>bt(m,e),g=()=>yt(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,Y.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&xt(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,Y.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,Y.useRef)(e.hosts),O,k;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},k=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=k):(O=n[21],k=n[22]),(0,Y.useEffect)(O,k);let A;n[23]===e.hosts?A=n[24]:(A=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=A);let j=A,M,N;n[25]!==m||n[26]!==j?(M=()=>{let e=yt(m).hosts;e&&[...e].sort().join(`,`)===j&&xt(m,{hosts:null})},N=[j,m],n[25]=m,n[26]=j,n[27]=M,n[28]=N):(M=n[27],N=n[28]),(0,Y.useEffect)(M,N);let P=(0,Y.useRef)(null),F=(0,Y.useRef)(null),I,L;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current),F.current?.(),F.current=null},L=[],n[29]=I,n[30]=L):(I=n[29],L=n[30]),(0,Y.useEffect)(I,L);let z;n[31]!==t||n[32]!==m||n[33]!==e?(z=function(n,r){D.current=n,xt(m,{hosts:n}),P.current&&clearTimeout(P.current);let i=async()=>{F.current=null,P.current=null;let r=await t.install(e,n.filter(R));if(!r.ok){xt(m,{hosts:null});return}D.current=[...r.hosts],xt(m,{hosts:[...r.hosts]})};r?(F.current=()=>void i(),P.current=setTimeout(()=>void i(),350)):(F.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=z):z=n[34];let B=z,V;return n[35]!==t||n[36]!==B||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(V={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),B([...n],!0)},installAll(){let t=D.current.filter(kt),n=e.installableEditors??St,r=St.filter(e=>n.includes(e)||D.current.includes(e));B([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>q({scope:e.scope,name:e.name,dir:n,mode:r})).then(Ot)},unplaceAt(n){t.runLocationWrite(e,()=>ie({scope:e.scope,name:e.name,path:n})).then(Dt)},setSource(n){xt(m,{source:n}),t.runLocationWrite(e,()=>G({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(xt(m,{source:null}),ee.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=B,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=V):V=n[44],V}function Dt(e){e.ok||ee.error(e.error)}function Ot(e){e.ok||ee.error(e.error)}function kt(e){return!St.includes(e)}function $(e){let t=(0,X.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,J.jsx)(u,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,J.jsx)(d,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,J.jsxs)(f,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function At(e){let t=(0,X.c)(77),{toggles:n,skill:r,onResolveFork:o,onRunStart:s,menuKind:c}=e,u=c===void 0?`dropdown`:c,{_:d}=a(),{hostSet:f,toggleEditor:p,installAll:m}=n,h=K(),g,_,v,y,b,x,S,C,w,T;if(t[0]!==d||t[1]!==h.data||t[2]!==h.status||t[3]!==f||t[4]!==m||t[5]!==u||t[6]!==o||t[7]!==s||t[8]!==r||t[9]!==p||t[10]!==n){let{pathFor:e,aliases:a,rows:c,sourceRow:E,sourceHost:D,conflicted:O,drifted:k,linked:A,expectedMode:j,convertible:M,customRootRows:N}=wt({skill:r,allSkills:h.status===`ready`?h.data:null,hostSet:f,sourceHostOverlay:n.sourceHost,linkMode:n.linkMode});b=c,x=E,y=j,_=M,v=N;let P=e=>re(a,e),F=Lt,I=e=>{let t=P(e);return t.length===0?!0:window.confirm(d({id:`Uobeu9`,values:{0:t.map(F).join(`, `),rootRel:e}}))},L;t[21]!==d||t[22]!==r?(L=(e,t)=>{let n=e.includes(`/`)?e:ne(e,r?.scope??`project`);return(0,J.jsx)($,{hint:d({id:`0dslv8`,values:{0:F(e),1:F(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":d({id:`G6Lrs_`,values:{0:F(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(d({id:`iiqOKM`,values:{0:F(e),1:r.name,2:F(e),subRoot:n,poolRootRel:t}}))&&ae({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?V():ee.error(d({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,J.jsx)(it,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[21]=d,t[22]=r,t[23]=L):L=t[23];let R=L;g=n.installing;let z=It,H;t[24]!==d||t[25]!==s||t[26]!==n?(H=(e,t,r)=>{let a=r===`link`?`copy`:`link`;return(0,J.jsx)($,{hint:d(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(d(a===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(s?.(),n.convertLocation?.(e,a))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,J.jsx)(i,{id:`uUCrBv`}):(0,J.jsx)(i,{id:`iaPtht`})})})},t[24]=d,t[25]=s,t[26]=n,t[27]=H):H=t[27];let U=H,W;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,J.jsx)(i,{id:`npcziF`}),t[28]=W):W=t[28];let G;t[29]===d?G=t[30]:(G=d({id:`6f_UX4`}),t[29]=d,t[30]=G);let K;t[31]===m?K=t[32]:(K=()=>m(),t[31]=m,t[32]=K);let ie;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,J.jsx)(i,{id:`N40H-G`}),t[33]=ie):ie=t[33];let q;t[34]!==g||t[35]!==K?(q=(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:g,onClick:K,"data-testid":`skill-install-all`,children:ie}),t[34]=g,t[35]=K,t[36]=q):q=t[36];let Y;t[37]!==G||t[38]!==q?(Y=(0,J.jsx)($,{hint:G,children:q}),t[37]=G,t[38]=q,t[39]=Y):Y=t[39],t[40]!==u||t[41]!==Y?(S=(0,J.jsxs)(ut,{menuKind:u,className:`flex items-center justify-between gap-2`,children:[W,Y]}),t[40]=u,t[41]=Y,t[42]=S):S=t[42],C=x===null?null:(0,J.jsx)($,{hint:d({id:`pXB6SL`}),children:(0,J.jsxs)(lt,{menuKind:u,disabled:g,checked:!0,onSelect:Ft,"data-testid":`skill-source-row`,children:[(0,J.jsx)(te,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:x}),(()=>{let e=z(x).split(`/`).slice(0,-1).join(`/`),t=P(e);return t.length>0?(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>R(t,e))}):null})(),(0,J.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,J.jsx)(i,{id:`tiFPjk`})})]})]})}),w=b.map(t=>{let a=e(t),s=t===`agents`?`.agents`:B[t],c=z(a).split(`/`).slice(0,-1).join(`/`),m=P(c);return(0,J.jsx)($,{hint:O.has(t)?d({id:`8HvJlU`,values:{0:a??s}}):t===D?a?d({id:`ssk6rl`,values:{path:a}}):s:f.has(t)?d(a?{id:`9ieZhu`,values:{path:a}}:{id:`n3T3EE`,values:{label:s}}):d(a?y===`link`?{id:`1LtA5r`,values:{path:a}}:{id:`opPbzN`,values:{path:a}}:{id:`Pp0Vgd`,values:{label:s}}),children:(0,J.jsxs)(lt,{menuKind:u,disabled:g,checked:f.has(t),onCheckedChange:e=>{O.has(t)||e===!0&&!I(c)||p(t,e===!0)},onSelect:Pt,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,J.jsx)(it,{host:t,"aria-hidden":!0,className:`size-4`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a??s}),m.length>0?(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${t}`,children:m.map(e=>R(e,c))}):null,O.has(t)?(0,J.jsx)($,{hint:d({id:`_O7dJS`}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:e=>{e.preventDefault(),o?.(t)},"data-testid":`skill-fork-chip-${t}`,children:(0,J.jsx)(i,{id:`jng7Ko`})})}):t===D?(0,J.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,J.jsx)(i,{id:`tiFPjk`})}):f.has(t)&&r?.hosts?(0,J.jsxs)(J.Fragment,{children:[!g&&(A.has(t)?`link`:`copy`)!==y?U(t,a??s,A.has(t)?`link`:`copy`):null,(0,J.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n.setSource?.(t)},"data-testid":`skill-set-source-${t}`,children:(0,J.jsx)(i,{id:`VNNRfN`})})})]}):null,!g&&k.has(z(a))?(0,J.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,J.jsx)(ot,{testId:`skill-drift-${t}`})}):null]})]})},t)}),T=v.map(e=>(0,J.jsx)($,{hint:e.placed===null?d(y===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):d({id:`C0cll5`,values:{0:e.display}}),children:(0,J.jsxs)(lt,{menuKind:u,disabled:g,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!I(e.root))return;n.placeAt(e.root,y)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:Nt,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,J.jsx)(it,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,J.jsx)(te,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),P(e.root).length>0?(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:P(e.root).map(t=>R(t,e.root))}):null,!g&&e.placed!==null&&k.has(e.placed.path)?(0,J.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,J.jsx)(ot,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,J.jsxs)(J.Fragment,{children:[!g&&e.placed.mode!==y?U(e.root,e.display,e.placed.mode):null,(0,J.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,J.jsx)(i,{id:`VNNRfN`})})})]})]})]})},e.root)),t[0]=d,t[1]=h.data,t[2]=h.status,t[3]=f,t[4]=m,t[5]=u,t[6]=o,t[7]=s,t[8]=r,t[9]=p,t[10]=n,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T}else g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20];let E;t[43]!==v||t[44]!==b.length||t[45]!==x?(E=b.length===0&&v.length===0&&x===null?(0,J.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,J.jsx)(i,{id:`MOAoFO`})}):null,t[43]=v,t[44]=b.length,t[45]=x,t[46]=E):E=t[46];let D;t[47]!==d||t[48]!==g||t[49]!==_||t[50]!==y||t[51]!==s||t[52]!==n?(D=_.length>0&&n.convertLocations?(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=y===`link`?`copy`:`link`,r=_.filter(e=>e.mode!==t);if(r.length===0)return;let i=d(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),a=d(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),o=r.map(Mt).join(`
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Nn as n}from"./DocumentContext-CuOcLr_j.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./utils-CPqDy6Hr.js";import{t as c}from"./mascot-outline-CtS592mc.js";import{t as l}from"./button-CA0dewJJ.js";import{i as u,n as d,t as f}from"./tooltip-DPvMEqsq.js";import{a as p,c as m,i as h,l as g,o as _,r as v,s as y}from"./alert-dialog-ZBAB0rfs.js";import{c as b,d as x,f as S,l as C,m as w,o as T,p as E,r as D,u as O,w as k}from"./terminal-cli-display-DQFap0a9.js";import{a as A,d as j,f as M,i as N,n as P,o as F,p as I,u as L}from"./dropdown-menu-DRIarAms.js";import{$r as R,Kt as z,oo as B}from"./dist-DKOit9IV2.js";import{n as ee}from"./dist-DTX2HxC82.js";import{s as V}from"./documents-events-CswIH8-8.js";import{t as H}from"./createLucideIcon-CAkY8Blx.js";import{o as te}from"./use-open-skill-DdfCbjRH.js";import{t as U}from"./spinner-DmibE6UV.js";import{c as ne,n as re,r as W}from"./skill-scope-C_bc3f6T.js";import{A as G,F as K,M as ie,S as ae,x as q}from"./skills-api-B3AiUodv.js";var J=t(),Y=e(r(),1),X=o(),oe=3100,se=3;function ce(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??se;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var le={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},ue=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function de(e,t={}){let n=t.rng??Math.random,r=t.colors??ue,i=le[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var fe=1.8,pe=90,me=16,he=380,ge=.025,_e=.1,ve=.18,ye=400,be=9.2736,xe=18.1799,Se=14.5244,Ce={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function we(e,t){let{halfWidth:n,apexLift:r}=Ce[t];return`M${e-n} ${Se+.3} Q${e} ${Se-r}, ${e+n} ${Se+.3}`}function Te(e){let t=1.5,n=.3;return`M${e-t} ${Se-n} Q${e} ${Se+1.4}, ${e+t} ${Se-n}`}var Ee=15,De=15;function Oe(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function ke(e){let t=(0,X.c)(73),{size:n,className:r,style:i,trackMouse:a,variant:o,celebrateSignal:l,onRage:u}=e,d=n===void 0?48:n,f=a===void 0?!0:a,p=o===void 0?`default`:o,m=l===void 0?0:l,h=(0,Y.useRef)(null),g=(0,Y.useRef)(null),_=(0,Y.useRef)(null),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={x:0,y:0},t[0]=v):v=t[0];let y=(0,Y.useRef)(v),[b,x]=(0,Y.useState)(0),[S,C]=(0,Y.useState)(0),[w,T]=(0,Y.useState)(0),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[1]=E):E=t[1];let[D,O]=(0,Y.useState)(E),k=(0,Y.useRef)(0),A=(0,Y.useRef)(0),j=(0,Y.useRef)(void 0),M=p===`sleeping`,N;t[2]!==b||t[3]!==M||t[4]!==u?(N=function(){if(M)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=A.current===0?1/0:e-A.current;A.current=e;let n=ce(b,t),r=b===3&&e-k.current<3100,i=n===3&&r;n===3&&u?.(),x(n),C(Fe),i||(O(de(n)),n===3&&(k.current=e,T(Pe))),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},oe)},t[2]=b,t[3]=M,t[4]=u,t[5]=N):N=t[5];let P=N,F,I;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>()=>clearTimeout(j.current),I=[],t[6]=F,t[7]=I):(F=t[6],I=t[7]),(0,Y.useEffect)(F,I);let L,R;t[8]!==m||t[9]!==M?(L=()=>{m===0||M||(x(3),C(Ne),O(de(3)),k.current=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),T(Me),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},oe))},R=[m,M],t[8]=m,t[9]=M,t[10]=L,t[11]=R):(L=t[10],R=t[11]),(0,Y.useEffect)(L,R);let z,B;t[12]!==M||t[13]!==f?(z=()=>{if(!f||M||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,c=function(){s===0&&(s=requestAnimationFrame(u))},l=function(r){e=r.clientX,t=r.clientY,n=!0,c()};function u(){s=0;let l=g.current,u=h.current;if(!l||!u){c();return}let d=n;n=!1;let f=l.getBoundingClientRect(),p=f.left+f.width/2,m=f.top+f.height*.48,v=e-p,b=t-m,x=Math.hypot(v,b),S=Math.max(-1,Math.min(1,v/he)),C=-Math.max(-1,Math.min(1,b/he))*me,w=S*me,T=0,E=0;if(x>=1){let e=Math.min(x/pe,1)*fe;T=v/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!d&&D)return;c(),r+=(C-r)*_e,i+=(w-i)*_e,u.style.transform=`perspective(${ye}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*ve,o+=(E-o)*ve;let O=i*ge,k=-r*ge,A=a+O,j=o+k;y.current.x=A,y.current.y=j,_.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,l,{passive:!0}),c(),()=>{document.removeEventListener(`mousemove`,l),s!==0&&cancelAnimationFrame(s),s=0,h.current&&(h.current.style.transform=``),y.current={x:0,y:0},_.current?.removeAttribute(`transform`)}},B=[f,M],t[12]=M,t[13]=f,t[14]=z,t[15]=B):(z=t[14],B=t[15]),(0,Y.useEffect)(z,B);let ee;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{let e=_.current;if(!e)return;let{x:t,y:n}=y.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=ee):ee=t[16],(0,Y.useLayoutEffect)(ee);let V=b>0,H=V?b:1,te=V?`ok-blob-clicked-${b}`:null,U;t[17]===r?U=t[18]:(U=s(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=U);let ne=M?`cursor-default`:`cursor-pointer`,re=`body-${S}`,W=M&&`ok-blob-sleeping`,G;t[19]!==te||t[20]!==W?(G=s(`ok-blob-group`,W,te),t[19]=te,t[20]=W,t[21]=G):G=t[21];let K;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,J.jsx)(`path`,{d:c,className:`ok-blob-body`}),t[22]=K):K=t[22];let ie=(V||M)&&`ok-blob-eye-hidden`,ae;t[23]===ie?ae=t[24]:(ae=s(`ok-blob-eye`,ie),t[23]=ie,t[24]=ae);let q;t[25]===ae?q=t[26]:(q=(0,J.jsx)(`ellipse`,{cx:be,cy:Se,rx:1.2722,ry:1.9083,className:ae}),t[25]=ae,t[26]=q);let se=(V||M)&&`ok-blob-eye-hidden`,le;t[27]===se?le=t[28]:(le=s(`ok-blob-eye ok-blob-eye-right`,se),t[27]=se,t[28]=le);let ue;t[29]===le?ue=t[30]:(ue=(0,J.jsx)(`ellipse`,{cx:xe,cy:Se,rx:1.2722,ry:1.9083,className:le}),t[29]=le,t[30]=ue);let Ce;t[31]===H?Ce=t[32]:(Ce=we(be,H),t[31]=H,t[32]=Ce);let Ee=(!V||M)&&`ok-blob-eye-hidden`,De;t[33]===Ee?De=t[34]:(De=s(`ok-blob-happy-eye`,Ee),t[33]=Ee,t[34]=De);let Oe;t[35]!==Ce||t[36]!==De?(Oe=(0,J.jsx)(`path`,{d:Ce,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:De}),t[35]=Ce,t[36]=De,t[37]=Oe):Oe=t[37];let ke;t[38]===H?ke=t[39]:(ke=we(xe,H),t[38]=H,t[39]=ke);let Ie=(!V||M)&&`ok-blob-eye-hidden`,Le;t[40]===Ie?Le=t[41]:(Le=s(`ok-blob-happy-eye`,Ie),t[40]=Ie,t[41]=Le);let Re;t[42]!==ke||t[43]!==Le?(Re=(0,J.jsx)(`path`,{d:ke,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:Le}),t[42]=ke,t[43]=Le,t[44]=Re):Re=t[44];let Z;t[45]===M?Z=t[46]:(Z=M?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`path`,{d:Te(be),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,J.jsx)(`path`,{d:Te(xe),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=M,t[46]=Z);let ze;t[47]!==q||t[48]!==ue||t[49]!==Oe||t[50]!==Re||t[51]!==Z?(ze=(0,J.jsxs)(`g`,{ref:_,children:[q,ue,Oe,Re,Z]}),t[47]=q,t[48]=ue,t[49]=Oe,t[50]=Re,t[51]=Z,t[52]=ze):ze=t[52];let Be;t[53]!==re||t[54]!==G||t[55]!==ze?(Be=(0,J.jsxs)(`g`,{className:G,children:[K,ze]},re),t[53]=re,t[54]=G,t[55]=ze,t[56]=Be):Be=t[56];let Ve;t[57]===M?Ve=t[58]:(Ve=M?(0,J.jsxs)(`g`,{children:[(0,J.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,J.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[57]=M,t[58]=Ve);let Q;t[59]!==w||t[60]!==D?(Q=D.length>0&&(0,J.jsx)(`g`,{"data-slot":`ok-blob-burst`,children:D.map(Ae)},`firework-${w}`),t[59]=w,t[60]=D,t[61]=Q):Q=t[61];let He;t[62]!==P||t[63]!==d||t[64]!==ne||t[65]!==Be||t[66]!==Ve||t[67]!==Q?(He=(0,J.jsxs)(`svg`,{ref:g,width:d,height:d,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:ne,"aria-hidden":`true`,onClick:P,onMouseDown:je,children:[Be,Ve,Q]}),t[62]=P,t[63]=d,t[64]=ne,t[65]=Be,t[66]=Ve,t[67]=Q,t[68]=He):He=t[68];let Ue;return t[69]!==i||t[70]!==U||t[71]!==He?(Ue=(0,J.jsx)(`span`,{ref:h,className:U,style:i,children:He}),t[69]=i,t[70]=U,t[71]=He,t[72]=Ue):Ue=t[72],Ue}function Ae(e){return(0,J.jsx)(`circle`,{cx:Ee+e.originDx,cy:De+e.originDy,r:e.size,className:`ok-blob-firework`,style:Oe(e)},e.id)}function je(e){return e.preventDefault()}function Me(e){return e+1}function Ne(e){return e+1}function Pe(e){return e+1}function Fe(e){return e+1}var Ie=H(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Le=H(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Re=H(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Z=[...new Set(k.flatMap(e=>e.schemes))];function ze(e,t){let n=t.now?.()??Date.now(),r={};for(let t of k){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Be(e){return ze({},e)}async function Ve(e){let t=e.schemes??Z,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Q=Object.fromEntries(Z.map(e=>[e,{installed:!1}]));async function He(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Q}if(!t.ok)return Q;let n;try{n=await t.json()}catch{return Q}if(typeof n!=`object`||!n||Array.isArray(n))return Q;let r=n,i={};for(let e of Z)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Ue(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function We(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Be({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=ze(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Ue(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function Ge(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Ke(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Ve({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>He({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function qe(){let e=(0,X.c)(5),[t,n]=(0,Y.useState)(Je),r=(0,Y.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=We(Ke());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Y.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Je(){return Be({isElectronHost:Ge(),now:Date.now})}var Ye=(0,Y.createContext)(null);function Xe(e){let t=(0,X.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,J.jsx)(Ye,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Ze(){return(0,Y.use)(Ye)}function Qe(e){return!(e instanceof Error)||e.name!==`NotAllowedError`?!1:/permission denied|permissions policy/i.test(e.message)}function $e(e){let t=globalThis.document;if(!t?.body||typeof t.createElement!=`function`||typeof t.execCommand!=`function`)return!1;let n=t.createElement(`textarea`);n.value=e,n.style.position=`fixed`,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`readonly`,``),t.body.appendChild(n);try{return n.focus(),n.select(),t.execCommand(`copy`)}catch{return!1}finally{n.remove()}}async function et(e){let t=globalThis.okDesktop?.clipboard;if(t&&typeof t.writeText==`function`){await t.writeText(e);return}let n=globalThis.navigator?.clipboard;if(n&&typeof n.writeText==`function`)try{await n.writeText(e);return}catch(t){if($e(e))return;throw t}if(!$e(e))throw Error(`clipboard API unavailable`)}function tt(e){let t=(0,X.c)(48),{itemName:n,isSubmitting:r,onDelete:o,customTitle:s,customDescription:c,customDetail:u,customConfirmLabel:d,customConfirmLabelBusy:f,children:b}=e,{_:x}=a(),S;t[0]!==x||t[1]!==n?(S=n??x({id:`L3CEC1`}),t[0]=x,t[1]=n,t[2]=S):S=t[2];let C=S,w;t[3]!==x||t[4]!==d?(w=d??x({id:`cnGeoo`}),t[3]=x,t[4]=d,t[5]=w):w=t[5];let T=w,E;t[6]!==x||t[7]!==d||t[8]!==f?(E=f??d??x({id:`s3caR3`}),t[6]=x,t[7]=d,t[8]=f,t[9]=E):E=t[9];let D=E,O;t[10]!==x||t[11]!==s||t[12]!==C?(O=s??x({id:`77SdEP`,values:{itemName:C}}),t[10]=x,t[11]=s,t[12]=C,t[13]=O):O=t[13];let k;t[14]===O?k=t[15]:(k=(0,J.jsx)(g,{children:O}),t[14]=O,t[15]=k);let A;t[16]!==x||t[17]!==c||t[18]!==C?(A=c??x({id:`16D5Zj`,values:{itemName:C}}),t[16]=x,t[17]=c,t[18]=C,t[19]=A):A=t[19];let j;t[20]===A?j=t[21]:(j=(0,J.jsx)(_,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===u?M=t[23]:(M=u?(0,J.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:u}):null,t[22]=u,t[23]=M);let N;t[24]!==k||t[25]!==j||t[26]!==M?(N=(0,J.jsxs)(m,{children:[k,j,M]}),t[24]=k,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]===b?P=t[29]:(P=b?(0,J.jsx)(v,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsx)(i,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===r?I=t[32]:(I=(0,J.jsx)(h,{disabled:r,children:F}),t[31]=r,t[32]=I);let L;t[33]!==T||t[34]!==D||t[35]!==r?(L=r?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{"aria-hidden":`true`,className:`size-4`}),` `,D]}):T,t[33]=T,t[34]=D,t[35]=r,t[36]=L):L=t[36];let R;t[37]!==r||t[38]!==o||t[39]!==L?(R=(0,J.jsx)(l,{variant:`destructive`,onClick:o,disabled:r,children:L}),t[37]=r,t[38]=o,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==I||t[42]!==R?(z=(0,J.jsxs)(y,{children:[I,R]}),t[41]=I,t[42]=R,t[43]=z):z=t[43];let B;return t[44]!==P||t[45]!==z||t[46]!==N?(B=(0,J.jsxs)(p,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function nt(e){return e===`agents`||e===`.agents`||e.startsWith(`.agents/`)?`.agents`:e.includes(`/`)?e:B[e]??e}function rt(e){return e===`claude`?`claude-code`:e}function it(e){let t=(0,X.c)(18),r,i;if(t[0]===e?(r=t[1],i=t[2]):({host:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`agents`){let e;return t[3]===i?e=t[4]:(e=(0,J.jsx)(n,{...i}),t[3]=i,t[4]=e),e}if(r.includes(`/`)){if(r===`.agents`||r.startsWith(`.agents/`)){let e;return t[5]===i?e=t[6]:(e=(0,J.jsx)(n,{...i}),t[5]=i,t[6]=e),e}if(r===`.ok`||r.startsWith(`.ok/`)){let e;if(t[7]!==i){let{className:n,...r}=i;e=r,t[7]=i,t[8]=e}else e=t[8];let n=e,r;return t[9]===n?r=t[10]:(r=(0,J.jsx)(ke,{size:14,...n}),t[9]=n,t[10]=r),r}let e;return t[11]===i?e=t[12]:(e=(0,J.jsx)(te,{...i}),t[11]=i,t[12]=e),e}let a;t[13]===r?a=t[14]:(a=rt(r),t[13]=r,t[14]=a);let o;return t[15]!==i||t[16]!==a?(o=(0,J.jsx)(D,{...i,id:a}),t[15]=i,t[16]=a,t[17]=o):o=t[17],o}function at(e){let t=(0,X.c)(14),{hosts:n,className:r,iconClassName:i}=e,a,o,c;if(t[0]!==r||t[1]!==n||t[2]!==i){let e=n.slice(0,2),l=n.slice(2);t[6]===r?a=t[7]:(a=s(`flex items-center gap-1`,r),t[6]=r,t[7]=a);let p;t[8]===i?p=t[9]:(p=e=>(0,J.jsxs)(f,{children:[(0,J.jsx)(u,{asChild:!0,children:(0,J.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,J.jsx)(it,{host:e,className:s(`size-3.5 shrink-0`,i),"aria-label":nt(e)})})}),(0,J.jsx)(d,{children:nt(e)})]},e),t[8]=i,t[9]=p),o=e.map(p),c=l.length>0?(0,J.jsxs)(f,{children:[(0,J.jsx)(u,{asChild:!0,children:(0,J.jsxs)(`span`,{className:`ml-0.5 cursor-default`,children:[`+`,l.length]})}),(0,J.jsx)(d,{children:l.map(nt).join(`, `)})]}):null,t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=c}else a=t[3],o=t[4],c=t[5];let l;return t[10]!==a||t[11]!==o||t[12]!==c?(l=(0,J.jsxs)(`span`,{className:a,children:[o,c]}),t[10]=a,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function ot(e){let t=(0,X.c)(6),{testId:n,title:r}=e,a;t[0]===r?a=t[1]:(a=r===void 0?{}:{title:r},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(i,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,J.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide`,"data-testid":n,...a,children:o}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s}function st(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(b,{...r}):(0,J.jsx)(N,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ct(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(C,{...r}):(0,J.jsx)(A,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function lt(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(T,{...r}):(0,J.jsx)(P,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ut(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(O,{...r}):(0,J.jsx)(F,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function dt(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(x,{...r}):(0,J.jsx)(L,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ft(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(S,{...r}):(0,J.jsx)(j,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function pt(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(E,{...r}):(0,J.jsx)(M,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function mt(e){let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,J.jsx)(w,{...r}):(0,J.jsx)(I,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var ht=Object.freeze({hosts:null,source:null}),gt=new Map,_t=new Map;function vt(e,t){return`${e}:${t}`}function yt(e){return gt.get(e)??ht}function bt(e,t){let n=_t.get(e)??new Set;return _t.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&_t.delete(e)}}function xt(e,t){let n=yt(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?gt.delete(e):gt.set(e,r);for(let t of _t.get(e)??[])t()}}var St=z.options,Ct=`.agents/`;function wt({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${ne(t,e.scope)}/${e.name}`:null,o=e!==void 0&&((e.hosts??[]).includes(`agents`)||t?.some(e=>e.hosts.includes(`agents`)||e.path.startsWith(Ct))),s=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),c=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),l=c?new Set(c):null,u=(o?[...St,`agents`]:St).filter(e=>!(e in s)).filter(e=>e===`agents`||l===null||l.has(e)||n.has(e)),d=new Set(u.map(e=>a(e))),f=e?.scope===`global`?`~/`:``,p=e?.path?.includes(`/`)?`${f}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,m=p!==null&&!d.has(p)?p:null,h=m===null?r??e?.hosts?.[0]:void 0,g=new Set(e?.conflictHosts??[]),_=new Set(e?.driftPaths??[]),v=new Set(e?.symlinkedHosts??[]),y=[...[...n].filter(e=>e!==h&&!(e in s)&&!g.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:v.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:W(e),display:`${f}${e.path}`,mode:e.mode}))],b=y.map(e=>e.mode),x=b.filter(e=>e===`link`).length,S=b.length===0?i?`link`:`copy`:x*2>=b.length?`link`:`copy`,C=new Map((e?.customPlacements??[]).map(e=>[W(e),e])),w=new Set(C.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=W(e);t!==``&&w.add(t)}}return{pathFor:a,aliases:s,rows:u,sourceRow:m,sourceHost:h,conflicted:g,drifted:_,linked:v,expectedMode:S,convertible:y,customRootRows:e===void 0?[]:[...w].sort().map(t=>({root:t,display:`${f}${t}/${e.name}`,placed:C.get(t)??null})).filter(e=>!d.has(e.display)&&e.display!==p&&!(e.root in s))}}var Tt=`min-w-[24rem]`;function Et(e,t){let n=(0,X.c)(45),r=t.installingName===e.name,i=(0,Y.useRef)(e),[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,Y.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,Y.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=vt(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>bt(m,e),g=()=>yt(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,Y.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&xt(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,Y.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,Y.useRef)(e.hosts),O,k;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},k=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=k):(O=n[21],k=n[22]),(0,Y.useEffect)(O,k);let A;n[23]===e.hosts?A=n[24]:(A=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=A);let j=A,M,N;n[25]!==m||n[26]!==j?(M=()=>{let e=yt(m).hosts;e&&[...e].sort().join(`,`)===j&&xt(m,{hosts:null})},N=[j,m],n[25]=m,n[26]=j,n[27]=M,n[28]=N):(M=n[27],N=n[28]),(0,Y.useEffect)(M,N);let P=(0,Y.useRef)(null),F=(0,Y.useRef)(null),I,L;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current),F.current?.(),F.current=null},L=[],n[29]=I,n[30]=L):(I=n[29],L=n[30]),(0,Y.useEffect)(I,L);let z;n[31]!==t||n[32]!==m||n[33]!==e?(z=function(n,r){D.current=n,xt(m,{hosts:n}),P.current&&clearTimeout(P.current);let i=async()=>{F.current=null,P.current=null;let r=await t.install(e,n.filter(R));if(!r.ok){xt(m,{hosts:null});return}D.current=[...r.hosts],xt(m,{hosts:[...r.hosts]})};r?(F.current=()=>void i(),P.current=setTimeout(()=>void i(),350)):(F.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=z):z=n[34];let B=z,V;return n[35]!==t||n[36]!==B||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(V={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),B([...n],!0)},installAll(){let t=D.current.filter(kt),n=e.installableEditors??St,r=St.filter(e=>n.includes(e)||D.current.includes(e));B([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>q({scope:e.scope,name:e.name,dir:n,mode:r})).then(Ot)},unplaceAt(n){t.runLocationWrite(e,()=>ie({scope:e.scope,name:e.name,path:n})).then(Dt)},setSource(n){xt(m,{source:n}),t.runLocationWrite(e,()=>G({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(xt(m,{source:null}),ee.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=B,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=V):V=n[44],V}function Dt(e){e.ok||ee.error(e.error)}function Ot(e){e.ok||ee.error(e.error)}function kt(e){return!St.includes(e)}function $(e){let t=(0,X.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,J.jsx)(u,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,J.jsx)(d,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,J.jsxs)(f,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function At(e){let t=(0,X.c)(77),{toggles:n,skill:r,onResolveFork:o,onRunStart:s,menuKind:c}=e,u=c===void 0?`dropdown`:c,{_:d}=a(),{hostSet:f,toggleEditor:p,installAll:m}=n,h=K(),g,_,v,y,b,x,S,C,w,T;if(t[0]!==d||t[1]!==h.data||t[2]!==h.status||t[3]!==f||t[4]!==m||t[5]!==u||t[6]!==o||t[7]!==s||t[8]!==r||t[9]!==p||t[10]!==n){let{pathFor:e,aliases:a,rows:c,sourceRow:E,sourceHost:D,conflicted:O,drifted:k,linked:A,expectedMode:j,convertible:M,customRootRows:N}=wt({skill:r,allSkills:h.status===`ready`?h.data:null,hostSet:f,sourceHostOverlay:n.sourceHost,linkMode:n.linkMode});b=c,x=E,y=j,_=M,v=N;let P=e=>re(a,e),F=Lt,I=e=>{let t=P(e);return t.length===0?!0:window.confirm(d({id:`Uobeu9`,values:{0:t.map(F).join(`, `),rootRel:e}}))},L;t[21]!==d||t[22]!==r?(L=(e,t)=>{let n=e.includes(`/`)?e:ne(e,r?.scope??`project`);return(0,J.jsx)($,{hint:d({id:`0dslv8`,values:{0:F(e),1:F(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":d({id:`G6Lrs_`,values:{0:F(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(d({id:`iiqOKM`,values:{0:F(e),1:r.name,2:F(e),subRoot:n,poolRootRel:t}}))&&ae({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?V():ee.error(d({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,J.jsx)(it,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[21]=d,t[22]=r,t[23]=L):L=t[23];let R=L;g=n.installing;let z=It,H;t[24]!==d||t[25]!==s||t[26]!==n?(H=(e,t,r)=>{let a=r===`link`?`copy`:`link`;return(0,J.jsx)($,{hint:d(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(d(a===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(s?.(),n.convertLocation?.(e,a))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,J.jsx)(i,{id:`uUCrBv`}):(0,J.jsx)(i,{id:`iaPtht`})})})},t[24]=d,t[25]=s,t[26]=n,t[27]=H):H=t[27];let U=H,W;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,J.jsx)(i,{id:`npcziF`}),t[28]=W):W=t[28];let G;t[29]===d?G=t[30]:(G=d({id:`6f_UX4`}),t[29]=d,t[30]=G);let K;t[31]===m?K=t[32]:(K=()=>m(),t[31]=m,t[32]=K);let ie;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,J.jsx)(i,{id:`N40H-G`}),t[33]=ie):ie=t[33];let q;t[34]!==g||t[35]!==K?(q=(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:g,onClick:K,"data-testid":`skill-install-all`,children:ie}),t[34]=g,t[35]=K,t[36]=q):q=t[36];let Y;t[37]!==G||t[38]!==q?(Y=(0,J.jsx)($,{hint:G,children:q}),t[37]=G,t[38]=q,t[39]=Y):Y=t[39],t[40]!==u||t[41]!==Y?(S=(0,J.jsxs)(ut,{menuKind:u,className:`flex items-center justify-between gap-2`,children:[W,Y]}),t[40]=u,t[41]=Y,t[42]=S):S=t[42],C=x===null?null:(0,J.jsx)($,{hint:d({id:`pXB6SL`}),children:(0,J.jsxs)(lt,{menuKind:u,disabled:g,checked:!0,onSelect:Ft,"data-testid":`skill-source-row`,children:[(0,J.jsx)(te,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:x}),(()=>{let e=z(x).split(`/`).slice(0,-1).join(`/`),t=P(e);return t.length>0?(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>R(t,e))}):null})(),(0,J.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,J.jsx)(i,{id:`tiFPjk`})})]})]})}),w=b.map(t=>{let a=e(t),s=t===`agents`?`.agents`:B[t],c=z(a).split(`/`).slice(0,-1).join(`/`),m=P(c);return(0,J.jsx)($,{hint:O.has(t)?d({id:`8HvJlU`,values:{0:a??s}}):t===D?a?d({id:`ssk6rl`,values:{path:a}}):s:f.has(t)?d(a?{id:`9ieZhu`,values:{path:a}}:{id:`n3T3EE`,values:{label:s}}):d(a?y===`link`?{id:`1LtA5r`,values:{path:a}}:{id:`opPbzN`,values:{path:a}}:{id:`Pp0Vgd`,values:{label:s}}),children:(0,J.jsxs)(lt,{menuKind:u,disabled:g,checked:f.has(t),onCheckedChange:e=>{O.has(t)||e===!0&&!I(c)||p(t,e===!0)},onSelect:Pt,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,J.jsx)(it,{host:t,"aria-hidden":!0,className:`size-4`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a??s}),m.length>0?(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${t}`,children:m.map(e=>R(e,c))}):null,O.has(t)?(0,J.jsx)($,{hint:d({id:`_O7dJS`}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:e=>{e.preventDefault(),o?.(t)},"data-testid":`skill-fork-chip-${t}`,children:(0,J.jsx)(i,{id:`jng7Ko`})})}):t===D?(0,J.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,J.jsx)(i,{id:`tiFPjk`})}):f.has(t)&&r?.hosts?(0,J.jsxs)(J.Fragment,{children:[!g&&(A.has(t)?`link`:`copy`)!==y?U(t,a??s,A.has(t)?`link`:`copy`):null,(0,J.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n.setSource?.(t)},"data-testid":`skill-set-source-${t}`,children:(0,J.jsx)(i,{id:`VNNRfN`})})})]}):null,!g&&k.has(z(a))?(0,J.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,J.jsx)(ot,{testId:`skill-drift-${t}`})}):null]})]})},t)}),T=v.map(e=>(0,J.jsx)($,{hint:e.placed===null?d(y===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):d({id:`C0cll5`,values:{0:e.display}}),children:(0,J.jsxs)(lt,{menuKind:u,disabled:g,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!I(e.root))return;n.placeAt(e.root,y)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:Nt,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,J.jsx)(it,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,J.jsx)(te,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),P(e.root).length>0?(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:P(e.root).map(t=>R(t,e.root))}):null,!g&&e.placed!==null&&k.has(e.placed.path)?(0,J.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,J.jsx)(ot,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,J.jsxs)(J.Fragment,{children:[!g&&e.placed.mode!==y?U(e.root,e.display,e.placed.mode):null,(0,J.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,J.jsx)(i,{id:`VNNRfN`})})})]})]})]})},e.root)),t[0]=d,t[1]=h.data,t[2]=h.status,t[3]=f,t[4]=m,t[5]=u,t[6]=o,t[7]=s,t[8]=r,t[9]=p,t[10]=n,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T}else g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20];let E;t[43]!==v||t[44]!==b.length||t[45]!==x?(E=b.length===0&&v.length===0&&x===null?(0,J.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,J.jsx)(i,{id:`MOAoFO`})}):null,t[43]=v,t[44]=b.length,t[45]=x,t[46]=E):E=t[46];let D;t[47]!==d||t[48]!==g||t[49]!==_||t[50]!==y||t[51]!==s||t[52]!==n?(D=_.length>0&&n.convertLocations?(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,J.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=y===`link`?`copy`:`link`,r=_.filter(e=>e.mode!==t);if(r.length===0)return;let i=d(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),a=d(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),o=r.map(Mt).join(`
|
|
2
2
|
`);window.confirm(`${i}\n\n${a}\n\n${o}\n\n${d({id:`Cu6GXQ`})}`)&&(s?.(),n.convertLocations?.(r.map(e=>({target:e.target,mode:t}))))},disabled:g,"data-testid":`skill-convert-all`,children:y===`link`?(0,J.jsx)(i,{id:`rcJmK8`}):(0,J.jsx)(i,{id:`LBv_TR`})}),(0,J.jsx)($,{hint:d({id:`0J6nhG`}),children:(0,J.jsx)(l,{variant:`ghost`,size:`sm`,"aria-label":d({id:`qJSo0_`}),className:`size-4 shrink-0 rounded-full border border-border/60 p-0 font-normal text-[9px] text-muted-foreground hover:border-foreground/40 hover:bg-transparent hover:text-foreground`,onClick:jt,"data-testid":`skill-convert-all-help`,children:`?`})})]}):null,t[47]=d,t[48]=g,t[49]=_,t[50]=y,t[51]=s,t[52]=n,t[53]=D):D=t[53];let O;t[54]===u?O=t[55]:(O=(0,J.jsx)(dt,{menuKind:u}),t[54]=u,t[55]=O);let k;t[56]===d?k=t[57]:(k=d({id:`5ymuTA`}),t[56]=d,t[57]=k);let A;t[58]===r?.scope?A=t[59]:(A=()=>{window.location.hash=r?.scope===`global`?`#settings/user-skills`:`#settings/skills`},t[58]=r?.scope,t[59]=A);let j,M;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,J.jsx)(Re,{"aria-hidden":!0}),M=(0,J.jsx)(i,{id:`ZBF9fn`}),t[60]=j,t[61]=M):(j=t[60],M=t[61]);let N;t[62]!==u||t[63]!==A?(N=(0,J.jsxs)(ct,{menuKind:u,onSelect:A,children:[j,M]}),t[62]=u,t[63]=A,t[64]=N):N=t[64];let P;t[65]!==N||t[66]!==k?(P=(0,J.jsx)($,{hint:k,children:N}),t[65]=N,t[66]=k,t[67]=P):P=t[67];let F;return t[68]!==P||t[69]!==S||t[70]!==C||t[71]!==w||t[72]!==T||t[73]!==E||t[74]!==D||t[75]!==O?(F=(0,J.jsxs)(J.Fragment,{children:[S,C,w,T,E,D,O,P]}),t[68]=P,t[69]=S,t[70]=C,t[71]=w,t[72]=T,t[73]=E,t[74]=D,t[75]=O,t[76]=F):F=t[76],F}function jt(e){return e.preventDefault()}function Mt(e){return e.display}function Nt(e){return e.preventDefault()}function Pt(e){return e.preventDefault()}function Ft(e){return e.preventDefault()}function It(e){return(e??``).replace(/^~\//,``)}function Lt(e){return e===`agents`?`.agents`:B[e]??e}export{Ie as C,Le as S,et as _,st as a,qe as b,ft as c,ot as d,it as f,Qe as g,tt as h,St as i,pt as l,nt as m,At as n,ct as o,at as p,Et as r,dt as s,Tt as t,mt as u,Xe as v,ke as w,Re as x,Ze as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{i as s,n as c,t as l}from"./tooltip-DPvMEqsq.js";import{t as u}from"./switch-BeP1gMN6.js";import{t as d}from"./arrow-up-right-CXMA4cr5.js";import{t as f}from"./spinner-DmibE6UV.js";import{t as p}from"./refresh-cw-D41gUk_B.js";import{t as m}from"./undo-2-CXHp9Ngg.js";import{a as h,c as g,i as _,n as v,o as y,s as b,t as x}from"./dialog-DD-GTVf9.js";import{t as S}from"./use-skill-origin-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{i as s,n as c,t as l}from"./tooltip-DPvMEqsq.js";import{t as u}from"./switch-BeP1gMN6.js";import{t as d}from"./arrow-up-right-CXMA4cr5.js";import{t as f}from"./spinner-DmibE6UV.js";import{t as p}from"./refresh-cw-D41gUk_B.js";import{t as m}from"./undo-2-CXHp9Ngg.js";import{a as h,c as g,i as _,n as v,o as y,s as b,t as x}from"./dialog-DD-GTVf9.js";import{t as S}from"./use-skill-origin-CnlwuiEX.js";import{t as C}from"./DiffView-DrIxcON3.js";var w=e(n(),1),T=a(),E=t();function D(e){let t=(0,T.c)(31),{open:n,onOpenChange:i,skillName:a,localBody:s,upstreamBody:c,applying:l,onTakeUpstream:u}=e,d;t[0]===a?d=t[1]:(d=(0,E.jsx)(g,{children:(0,E.jsx)(r,{id:`EPKVES`,values:{skillName:a}})}),t[0]=a,t[1]=d);let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,E.jsx)(h,{children:(0,E.jsx)(r,{id:`kKw0H3`})}),t[2]=f):f=t[2];let p;t[3]===d?p=t[4]:(p=(0,E.jsxs)(b,{children:[d,f]}),t[3]=d,t[4]=p);let m;t[5]!==s||t[6]!==c?(m=(0,E.jsx)(v,{className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsx)(C,{oldContent:s,newContent:c,layout:`unified`})}),t[5]=s,t[6]=c,t[7]=m):m=t[7];let S;t[8]===i?S=t[9]:(S=()=>i(!1),t[8]=i,t[9]=S);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(r,{id:`Tq3pcs`}),t[10]=w):w=t[10];let D;t[11]!==l||t[12]!==S?(D=(0,E.jsx)(o,{variant:`outline`,onClick:S,disabled:l,children:w}),t[11]=l,t[12]=S,t[13]=D):D=t[13];let O;t[14]===l?O=t[15]:(O=l?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`qkqG0b`}),t[14]=l,t[15]=O);let k;t[16]!==l||t[17]!==u||t[18]!==O?(k=(0,E.jsx)(o,{onClick:u,disabled:l,children:O}),t[16]=l,t[17]=u,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==D||t[21]!==k?(A=(0,E.jsxs)(y,{children:[D,k]}),t[20]=D,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==A||t[24]!==p||t[25]!==m?(j=(0,E.jsxs)(_,{className:`flex max-h-[85vh] max-w-3xl flex-col`,children:[p,m,A]}),t[23]=A,t[24]=p,t[25]=m,t[26]=j):j=t[26];let M;return t[27]!==i||t[28]!==n||t[29]!==j?(M=(0,E.jsx)(x,{open:n,onOpenChange:i,children:j}),t[27]=i,t[28]=n,t[29]=j,t[30]=M):M=t[30],M}function O(e){let t=(0,T.c)(48),{scope:n,name:a}=e,{_:h}=i(),g;t[0]!==a||t[1]!==n?(g={scope:n,name:a},t[0]=a,t[1]=n,t[2]=g):g=t[2];let{origin:_,github:v,displaySource:y,importedTitle:b,canReimport:x,updateAvailable:C,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=S(g),[R,z]=(0,w.useState)(null),B;t[3]!==O||t[4]!==F||t[5]!==N?(B=async function(){if(O){let e=await F();e&&z(e);return}await N()},t[3]=O,t[4]=F,t[5]=N,t[6]=B):B=t[6];let V=B,H;t[7]===N?H=t[8]:(H=async function(){await N(),z(null)},t[7]=N,t[8]=H);let U=H;if(!_)return null;let W;t[9]!==y||t[10]!==v||t[11]!==b?(W=v?(0,E.jsxs)(`a`,{href:v,target:`_blank`,rel:`noreferrer`,title:b??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:y}),(0,E.jsx)(d,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,E.jsx)(`span`,{title:b??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:y}),t[9]=y,t[10]=v,t[11]=b,t[12]=W):W=t[12];let G;t[13]!==h||t[14]!==k||t[15]!==x||t[16]!==A||t[17]!==j?(G=x?(0,E.jsxs)(l,{children:[(0,E.jsx)(s,{asChild:!0,children:(0,E.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,E.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,E.jsx)(r,{id:`2M0JF6`})}),(0,E.jsx)(u,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":h({id:`o9fPtM`}),className:`scale-75`})]})}),(0,E.jsx)(c,{side:`bottom`,children:A?(0,E.jsx)(r,{id:`vy_VIN`}):k?(0,E.jsx)(r,{id:`vGQxBT`}):(0,E.jsx)(r,{id:`9p_QBN`})})]}):null,t[13]=h,t[14]=k,t[15]=x,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,E.jsxs)(l,{children:[(0,E.jsx)(s,{asChild:!0,children:(0,E.jsx)(`span`,{className:`shrink-0 rounded-sm bg-amber-500/15 px-1.5 py-0.5 font-medium text-[11px] text-amber-700 dark:text-amber-400`,children:(0,E.jsx)(r,{id:`tgWuMB`})})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==h||t[22]!==x||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&x&&M?(0,E.jsxs)(l,{children:[(0,E.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":h({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(s,{children:[L?(0,E.jsx)(f,{icon:m,className:`size-3`,"aria-hidden":!0}):(0,E.jsx)(m,{className:`size-3`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,E.jsx)(r,{id:`fIJtam`}):(0,E.jsx)(r,{id:`jJdwCB`})})]})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`XSb9HS`})})]}):null,t[21]=h,t[22]=x,t[23]=O,t[24]=P,t[25]=I,t[26]=M,t[27]=L,t[28]=q):q=t[28];let J;t[29]!==h||t[30]!==x||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==C?(J=x&&C?(0,E.jsxs)(l,{children:[(0,E.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":h({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(s,{children:[P?(0,E.jsx)(f,{icon:p,className:`size-3`,"aria-hidden":!0}):(0,E.jsx)(p,{className:`size-3`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`EkH9pt`})})]})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`GidGkh`})})]}):null,t[29]=h,t[30]=x,t[31]=V,t[32]=P,t[33]=L,t[34]=C,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==a||t[38]!==U||t[39]!==P?(Y=R?(0,E.jsx)(D,{open:!0,onOpenChange:e=>{e||z(null)},skillName:a,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()}):null,t[36]=R,t[37]=a,t[38]=U,t[39]=P,t[40]=Y):Y=t[40];let X;return t[41]!==W||t[42]!==G||t[43]!==K||t[44]!==q||t[45]!==J||t[46]!==Y?(X=(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs`,children:[W,G,K,q,J,Y]}),t[41]=W,t[42]=G,t[43]=K,t[44]=q,t[45]=J,t[46]=Y,t[47]=X):X=t[47],X}export{O as SkillOriginInline};
|
package/dist/public/assets/{SkillToolbarControls-6i3dV6vs.js → SkillToolbarControls-ovUDGFiC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{C as s,S as c,n as l,p as u,r as d,t as f}from"./SkillInstallMenu-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{C as s,S as c,n as l,p as u,r as d,t as f}from"./SkillInstallMenu-QQXII2hZ.js";import{t as p}from"./button-CA0dewJJ.js";import{a as m,c as h,l as g,m as _,o as v,r as y,t as ee,u as b}from"./dropdown-menu-DRIarAms.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./select-fWSYgcDA.js";import{a as O,i as k,u as A}from"./skill-actions-CONIft3w.js";import{t as j}from"./chevron-down-xENV92Te.js";import{t as M}from"./list-plus-1_iMFVqs.js";import{f as N,i as P,t as F}from"./skill-scope-C_bc3f6T.js";import{F as I}from"./skills-api-B3AiUodv.js";var L=a(),R=e(n(),1),z=t();function B(e){let t=(0,L.c)(52),{scope:n,name:a}=e,{_:s}=i(),m=I(),h=k(),g;t[0]!==a||t[1]!==n||t[2]!==m.data||t[3]!==m.status?(g=m.status===`ready`?m.data.find(e=>e.scope===n&&e.name===a):void 0,t[0]=a,t[1]=n,t[2]=m.data,t[3]=m.status,t[4]=g):g=t[4];let v=g,b;t[5]!==v||t[6]!==a||t[7]!==n?(b=v??{scope:n,name:a,path:a,description:``,installed:!1,hosts:[]},t[5]=v,t[6]=a,t[7]=n,t[8]=b):b=t[8];let x=b,[S,C]=(0,R.useState)(!1),w=d(x,h),{installed:T,installing:E,hostSet:D}=w,O=v===void 0&&!T,A;t[9]!==v||t[10]!==D?(A=v?P(v,[...D]):[],t[9]=v,t[10]=D,t[11]=A):A=t[11];let M=A,N;t[12]!==h||t[13]!==x?(N=()=>h.requestFileCreate(x),t[12]=h,t[13]=x,t[14]=N):N=t[14];let F;t[15]===s?F=t[16]:(F=s({id:`leF0i_`}),t[15]=s,t[16]=F);let B;t[17]===s?B=t[18]:(B=s({id:`leF0i_`}),t[17]=s,t[18]=B);let V;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[19]=V):V=t[19];let H;t[20]!==N||t[21]!==F||t[22]!==B?(H=(0,z.jsx)(p,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:N,title:F,"aria-label":B,"data-testid":`skill-editor-new-file`,children:V}),t[20]=N,t[21]=F,t[22]=B,t[23]=H):H=t[23];let U=O?`resolving`:`installed`,W=O?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,G;t[24]===W?G=t[25]:(G=o(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,W),t[24]=W,t[25]=G);let K;t[26]!==M||t[27]!==E||t[28]!==O?(K=E?(0,z.jsx)(r,{id:`b4itZn`}):O?(0,z.jsx)(r,{id:`iKvAeG`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(r,{id:`eQkgKV`}),(0,z.jsx)(u,{hosts:M,className:`text-muted-foreground`})]}),t[26]=M,t[27]=E,t[28]=O,t[29]=K):K=t[29];let q;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,z.jsx)(j,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[30]=q):q=t[30];let J;t[31]!==E||t[32]!==G||t[33]!==K||t[34]!==U?(J=(0,z.jsx)(_,{asChild:!0,children:(0,z.jsxs)(p,{variant:`outline`,size:`sm`,disabled:E,"data-testid":`skill-install-menu-trigger`,"data-state":U,className:G,children:[K,q]})}),t[31]=E,t[32]=G,t[33]=K,t[34]=U,t[35]=J):J=t[35];let Y;t[36]!==h||t[37]!==x?(Y=e=>h.requestForkResolve(x,e),t[36]=h,t[37]=x,t[38]=Y):Y=t[38];let X;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(X=()=>C(!1),t[39]=X):X=t[39];let Z;t[40]!==x||t[41]!==Y||t[42]!==w?(Z=(0,z.jsx)(y,{align:`end`,className:f,children:(0,z.jsx)(l,{toggles:w,skill:x,onResolveFork:Y,onRunStart:X})}),t[40]=x,t[41]=Y,t[42]=w,t[43]=Z):Z=t[43];let Q;t[44]!==S||t[45]!==J||t[46]!==Z?(Q=(0,z.jsxs)(ee,{open:S,onOpenChange:C,children:[J,Z]}),t[44]=S,t[45]=J,t[46]=Z,t[47]=Q):Q=t[47];let $;return t[48]!==h.dialogs||t[49]!==Q||t[50]!==H?($=(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[H,Q,h.dialogs]}),t[48]=h.dialogs,t[49]=Q,t[50]=H,t[51]=$):$=t[51],$}function V(e){let t=(0,L.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=N(),d;t[0]===a?d=t[1]:(d=e=>a(e),t[0]=a,t[1]=d);let f;t[2]===l?f=t[3]:(f=l({id:`oCHfGC`}),t[2]=l,t[3]=f);let p;t[4]===c?p=t[5]:(p=o(`w-auto gap-1 text-xs font-mono uppercase`,c),t[4]=c,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(E,{}),t[6]=m):m=t[6];let h;t[7]!==f||t[8]!==p?(h=(0,z.jsx)(w,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:m}),t[7]=f,t[8]=p,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,z.jsx)(x,{children:(0,z.jsx)(r,{id:`oCHfGC`})}),t[10]=g):g=t[10];let _;t[11]===u?_=t[12]:(_=F.map(e=>(0,z.jsx)(S,{value:e,children:u[e]},e)),t[11]=u,t[12]=_);let v;t[13]===_?v=t[14]:(v=(0,z.jsx)(C,{align:`end`,children:(0,z.jsxs)(T,{children:[g,_]})}),t[13]=_,t[14]=v);let y;return t[15]!==s||t[16]!==d||t[17]!==h||t[18]!==v||t[19]!==n?(y=(0,z.jsxs)(D,{value:n,onValueChange:d,disabled:s,children:[h,v]}),t[15]=s,t[16]=d,t[17]=h,t[18]=v,t[19]=n,t[20]=y):y=t[20],y}function H(e){let t=(0,L.c)(12),{scope:n,name:r}=e,[i,a]=(0,R.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,z.jsx)(O,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function U(e){let t=(0,L.c)(45),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:c,problemCount:l,problemMessages:u}=e,{_:d}=i(),f=N(),x;t[0]!==a||t[1]!==n?(x={scope:n,name:a},t[0]=a,t[1]=n,t[2]=x):x=t[2];let S=H(x),C;t[3]!==S.requestMove||t[4]!==n?(C=(0,z.jsx)(V,{value:n,onRequestMove:S.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=S.requestMove,t[4]=n,t[5]=C):C=t[5];let w;t[6]!==a||t[7]!==n?(w=(0,z.jsx)(B,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=w):w=t[8];let T;t[9]!==C||t[10]!==w?(T=(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,w]}),t[9]=C,t[10]=w,t[11]=T):T=t[11];let E;t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==o?(E=o?(0,z.jsx)(A,{onAddProperty:c,problemCount:l,problemMessages:u,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=c,t[13]=l,t[14]=u,t[15]=o,t[16]=E):E=t[16];let D;t[17]===d?D=t[18]:(D=d({id:`Yzs3QX`}),t[17]=d,t[18]=D);let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,z.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[19]=O):O=t[19];let k;t[20]===D?k=t[21]:(k=(0,z.jsx)(_,{asChild:!0,children:(0,z.jsx)(p,{variant:`ghost`,size:`icon`,"aria-label":D,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:O})}),t[20]=D,t[21]=k);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,z.jsx)(v,{children:(0,z.jsx)(r,{id:`oCHfGC`})}),t[22]=j):j=t[22];let P;t[23]===S?P=t[24]:(P=e=>S.requestMove(e),t[23]=S,t[24]=P);let I;t[25]===f?I=t[26]:(I=F.map(e=>(0,z.jsx)(g,{value:e,children:f[e]},e)),t[25]=f,t[26]=I);let R;t[27]!==n||t[28]!==P||t[29]!==I?(R=(0,z.jsx)(h,{value:n,onValueChange:P,children:I}),t[27]=n,t[28]=P,t[29]=I,t[30]=R):R=t[30];let U;t[31]!==c||t[32]!==o?(U=o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(b,{}),(0,z.jsxs)(m,{onSelect:c,children:[(0,z.jsx)(M,{}),(0,z.jsx)(r,{id:`81H_23`})]})]}):null,t[31]=c,t[32]=o,t[33]=U):U=t[33];let W;t[34]!==R||t[35]!==U?(W=(0,z.jsxs)(y,{align:`end`,className:`min-w-44`,children:[j,R,U]}),t[34]=R,t[35]=U,t[36]=W):W=t[36];let G;t[37]!==W||t[38]!==k?(G=(0,z.jsxs)(ee,{children:[k,W]}),t[37]=W,t[38]=k,t[39]=G):G=t[39];let K;return t[40]!==S.dialog||t[41]!==G||t[42]!==T||t[43]!==E?(K=(0,z.jsxs)(z.Fragment,{children:[T,E,G,S.dialog]}),t[40]=S.dialog,t[41]=G,t[42]=T,t[43]=E,t[44]=K):K=t[44],K}export{U as SkillToolbarControls};
|
package/dist/public/assets/{SlidesToolbarControls-D5EykdNJ.js → SlidesToolbarControls-BBIxMkk8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{i as s,n as c,t as l}from"./tooltip-DPvMEqsq.js";import{gn as u}from"./dist-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{i as s,n as c,t as l}from"./tooltip-DPvMEqsq.js";import{gn as u}from"./dist-DKOit9IV2.js";import{t as d}from"./trace-api-CUqficfR.js";import{n as f}from"./dist-DTX2HxC82.js";import{n as p,t as m}from"./workspace-paths-CD0W1etA.js";import{t as h}from"./use-workspace-CQYB3HLR.js";import{t as g}from"./createLucideIcon-CAkY8Blx.js";var _=g(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{d.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=u(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=u(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();function E(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function D(e){let t=(0,y.c)(13),{provider:n,docName:a}=e,{_:u}=i(),d=w(n,`slides`),g=E(d),v=h();if(!d||g!==`available`)return null;let b;t[0]!==u||t[1]!==a||t[2]!==v?(b=async function(){let e=window.okDesktop?.slides;if(e==null||v==null)return;S();let t=p(v.contentDir,m(a),v.pathSeparator);try{let n=await e.open(t);if(!n.ok){let e;bb36:switch(n.reason){case`timeout`:e=u({id:`NeY1Np`});break bb36;case`exited-early`:e=u({id:`Lm3r51`});break bb36;case`unsupported-server`:e=u({id:`T_j5G0`});break bb36;case`spawn-error`:e=u({id:`TBfy1C`});break bb36;case`not-available`:case`invalid-path`:e=u({id:`X59Fx2`});break bb36;default:e=u({id:`X59Fx2`})}f.error(e)}}catch(e){let t=e;console.warn(`[slides] open dispatch failed:`,t instanceof Error?t:String(t)),f.error(u({id:`X59Fx2`}))}},t[0]=u,t[1]=a,t[2]=v,t[3]=b):b=t[3];let x=b,C;t[4]===u?C=t[5]:(C=u({id:`w52SKa`}),t[4]=u,t[5]=C);let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,T.jsx)(s,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[6]=D):D=t[6];let O;t[7]!==x||t[8]!==C?(O=(0,T.jsx)(o,{variant:`ghost`,size:`icon`,onClick:x,"aria-label":C,"data-testid":`slides-toolbar-action`,asChild:!0,children:D}),t[7]=x,t[8]=C,t[9]=O):O=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,T.jsx)(c,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[10]=k):k=t[10];let A;return t[11]===O?A=t[12]:(A=(0,T.jsxs)(l,{children:[O,k]}),t[11]=O,t[12]=A),A}export{D as SlidesToolbarControls};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,G as r,M as i,Ot as a,U as o,V as s,W as c,fn as l,lt as u,mt as d,pt as f,sn as ee,st as te}from"./DocumentContext-BrlDlUx7.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{A as g,O as ne,S as _,a as re,i as ie,o as ae}from"./CodeMirrorPropInput-SvCCpq_g.js";import{Do as v,Gi as oe,T as se,_o as y,do as b,ni as x}from"./dist-YRM6aCj22.js";import{n as ce}from"./config-context-BH8hj2sg.js";import{H as S,L as le,M as ue,O as de,P as fe,S as C,d as w,f as pe,i as me,j as he,l as ge,r as _e,t as ve,w as T}from"./typing-burst-detector-kXx1cN6a.js";import{f as E,g as D}from"./doc-paths-DHGjMfMc.js";import{J as O}from"./navigation-targets-CFQds_7M.js";import"./config-provider-CYqYSyJg.js";import{$ as k,D as A,Dt as j,F as M,It as N,Lt as P,Ot as F,Pt as I,Y as L,Z as R,b as z,ct as B,ft as V,g as H,gt as U,ht as ye,it as W,kt as be,l as G,lt as K,nt as q,pt as J,rt as Y,ut as X,v as xe}from"./dist-SEJoL7zW.js";import{a as Se,n as Ce}from"./cm-theme-Cv1HvKYn.js";import{i as we,n as Te,o as Ee,r as De}from"./dist-BmEWZ9WX.js";import{o as Oe,r as ke}from"./selection-context-4KGHvsgP.js";import{l as Ae}from"./lint-config-client-DDlKZf1J.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./dist-ChGC604M.js";import{n as Re,t as ze}from"./src-Dyjlw1SL.js";var Z=e(p(),1),Be=h();function Ve(){let e=r();return e===null?null:new Set(e.keys())}function He(e,t,n){let r=[],i=M(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);y.lastIndex=0;for(let e=y.exec(t);e!==null;e=y.exec(t)){let t=e[2];if(!v(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(L.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,c=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&v(l)&&n!=null)return r.push(L.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-o)),!1;let u=s.exec(c);if(u)return r.push(L.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),L.set(r)}function Ue(e){let t=c(e);return t===null?[]:[k.fromClass(class{decorations;constructor(e){this.decorations=He(e.state,e.visibleRanges,Ve())}update(e){(e.docChanged||e.viewportChanged||M(e.startState)!==M(e.state))&&(this.decorations=He(e.view.state,e.view.visibleRanges,Ve()))}},{decorations:e=>e.decorations}),R.domEventHandlers({mousedown(n){let i=n.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=r()?.get(a);return window.location.hash=e===void 0?D():E(O({scope:e.scope,name:a,path:e.path})),!0}let s=n.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(n.preventDefault(),window.location.hash=o(t,e,c),!0)}})]}var We=L.line({attributes:{dir:`auto`}});function Ge(e){let t=new I;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,We),r=n.to+1}return t.finish()}var Ke=k.fromClass(class{decorations;constructor(e){this.decorations=Ge(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Ge(e.view))}},{decorations:e=>e.decorations}),qe=[R.perLineTextDirection.of(!0),Ke],Je=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ye=`cm-lint-local-target`;function Xe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function Ze(e,t){let n=H(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Je.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function Qe(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function $e(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=Ze(e,Xe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:Qe(i.severity),message:T(i),source:`${i.source}/${i.code}`,markClass:Ye})}return r}var et=N.define();function tt(e){let t={findings:[]};return[Me(e=>ne()?$e(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(et)))}),k.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:et.of(null)}),Le(n)},i=C(e,e=>{e.status===`loaded`&&r(e.findings)}),a=g(()=>r(t.findings));return{destroy(){i(),a()}}})]}function nt(e,t){return e.enabled?[Ne(),Me(async n=>rt(n.state.doc,await x(n.state.doc.toString(),e,t)),{delay:600})]:[]}function Q(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function rt(e,t){let n=[];for(let r of t){let t=Q(e,r.range.start),i=Q(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=it(r);o&&(a.actions=[o]),n.push(a)}return n}function it(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:Q(n,e.range.start),to:Q(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var at=[J(),K(),X(),xe(),Y(),W(),be.allowMultipleSelections.of(!0),A(),G(),De(),Te(),U(),q(),B(),je(),V.of([...we,...Ce,...Ie,...z,...Ee,...Fe])],ot=L.mark({class:`cm-link-ref-broken`}),st=/^\s{0,3}\[([^\]]+)\]:\s/,ct=/\[([^\]]*)\]\[([^\]]*)\]/g,lt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function $(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function ut(e){let t=[];return M(e).iterate({enter(e){if(lt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function dt(e){let t=new Set,n=[],r=e.doc,i=ut(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if($(n.from,i))continue;let a=st.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!$(t.from,i)&&!st.test(t.text))for(ct.lastIndex=0;;){let e=ct.exec(t.text);if(!e)break;let r=t.from+e.index;if($(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ot.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),L.set(a)}var ft=P.define({create(e){return dt(e)},update(e,t){return t.docChanged?dt(t.state):e},provide:e=>R.decorations.from(e)}),pt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,mt=L.mark({class:`cm-del`}),ht=L.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),gt=L.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function _t(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function vt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!b.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(b.test(r.text))return{from:t.from,to:r.to}}return null}function yt(e,t){let n=[],r=M(e),i=vt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(mt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=pt.exec(r.text),a=i?i[1].length:2,o=L.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=_t(r.text),a=L.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(ht.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(gt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(gt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),L.set(n)}var bt=class{decorations;constructor(e){this.decorations=yt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||M(e.startState)!==M(e.state))&&(this.decorations=yt(e.view.state,e.view.visibleRanges))}},xt=k.fromClass(bt,{decorations:e=>e.decorations});function St(){return[xt,ft]}var Ct=t(),wt=N.define();function Tt(e,t,n){let r=w(e.state.doc)[t.index];r&&l(n,()=>{e.dispatch({selection:F.cursor(r.from),effects:R.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function Et(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);l(r,()=>{e.dispatch({selection:F.cursor(a),effects:R.scrollIntoView(a,{y:`center`})}),e.focus()})})}function Dt(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);l(n,()=>{e.dispatch({selection:F.cursor(o),effects:R.scrollIntoView(o,{y:`start`})}),e.focus()})}function Ot(e){let t=(0,Be.c)(50),{docName:r,ytext:o,provider:s,placeholder:c,isSourceModeActive:l}=e,p=(0,Z.useRef)(null),h=(0,Z.useRef)(null),[g,ne]=(0,Z.useState)(null);if(g)throw g;let{resolvedTheme:_}=m(),{merged:v}=ce(),y=(0,Z.useRef)(l),b=v?.editor?.wordWrap??!0,{data:x}=Ae(r),S;t[0]!==x?.effective||t[1]!==v?(S=x?.effective??(v?.contentRules?oe(v.contentRules):se),t[0]=x?.effective,t[1]=v,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E,D;t[5]===l?(E=t[6],D=t[7]):(E=()=>{y.current=l},D=[l],t[5]=l,t[6]=E,t[7]=D),(0,Z.useEffect)(E,D);let O=(0,Z.useRef)(null),k;t[8]!==r||t[9]!==C||t[10]!==c||t[11]!==s||t[12]!==_||t[13]!==b||t[14]!==o?(k=()=>{let e=p.current;if(!e)return;let t=s.configuration.name??``,l,m=At;try{l=f({docName:t,container:e,sizeStats:{viewCount:0,bytes:o.length},factory:e=>{let n=null,a=i({ydoc:s.document,ytext:o,docName:t}),l=new j,d=new j,f=new j,p=new j,h=new R({state:be.create({doc:o.toString(),extensions:[at,qe,Pe({scrollToMatch:e=>ee(t)?R.scrollIntoView(e,{y:`start`}):wt.of(null)}),V.of([Se]),ze(o,s.awareness),V.of(Re),...ie({themeCompartment:l,resolvedTheme:_,ydoc:s.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),St(),Ue(t),le(),p.of(nt(C,r)),tt(r),a,R.updateListener.of(e=>{te(e)&&u(t)}),R.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,_e(t,`source`,me(e.view)),ke(t,`source`,Oe(e.view,t))},120))}),f.of(ye(c??``)),R.theme({"&":{height:`100%`}}),R.scrollMargins.of(kt)]}),parent:e});_e(t,`source`,me(h)),ke(t,`source`,Oe(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,m),g.addEventListener(`paste`,m),g.addEventListener(`drop`,m),g.addEventListener(`cut`,m),{view:h,ydoc:s.document,ytext:o,provider:s,themeCompartment:l,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:p}}}),O.current=l,h.current=l.view,a(r,l.view),ve()&&l.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),O.current=null,h.current=null,ne(t instanceof Error?t:Error(String(t)))}return()=>{let e=O.current;e&&(d(e),n(r,e.view)),O.current=null,h.current=null}},t[8]=r,t[9]=C,t[10]=c,t[11]=s,t[12]=_,t[13]=b,t[14]=o,t[15]=k):k=t[15];let A;t[16]!==s||t[17]!==o?(A=[o,s],t[16]=s,t[17]=o,t[18]=A):A=t[18],(0,Z.useEffect)(k,A);let M,N;t[19]===r?(M=t[20],N=t[21]):(M=()=>{},N=[r],t[19]=r,t[20]=M,t[21]=N),(0,Z.useEffect)(M,N);let P,F;t[22]===_?(P=t[23],F=t[24]):(F=()=>{let e=O.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?re:ae)})},P=[_],t[22]=_,t[23]=P,t[24]=F),(0,Z.useEffect)(F,P);let I,L;t[25]===b?(I=t[26],L=t[27]):(I=()=>{let e=O.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?R.lineWrapping:[])})},L=[b],t[25]=b,t[26]=I,t[27]=L),(0,Z.useEffect)(I,L);let z,B;t[28]===c?(z=t[29],B=t[30]):(z=()=>{let e=O.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ye(c??``))})},B=[c],t[28]=c,t[29]=z,t[30]=B),(0,Z.useEffect)(z,B);let H;t[31]!==r||t[32]!==C?(H=()=>{let e=O.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(nt(C,r))})},t[31]=r,t[32]=C,t[33]=H):H=t[33];let U;t[34]===T?U=t[35]:(U=[T],t[34]=T,t[35]=U),(0,Z.useEffect)(H,U);let W,G;t[36]!==r||t[37]!==l?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==r||t.mode!==`source`||!l)return;let n=h.current;n&&(Tt(n,t,r),he(r))};return window.addEventListener(ge,e),()=>window.removeEventListener(ge,e)},G=[r,l],t[36]=r,t[37]=l,t[38]=W,t[39]=G):(W=t[38],G=t[39]),(0,Z.useEffect)(W,G);let K,q;t[40]!==r||t[41]!==l?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==r||!l)return;let n=h.current;n&&(Dt(n,t,r),he(r))};return window.addEventListener(pe,e),()=>window.removeEventListener(pe,e)},q=[r,l],t[40]=r,t[41]=l,t[42]=K,t[43]=q):(K=t[42],q=t[43]),(0,Z.useEffect)(K,q);let J,Y;t[44]!==r||t[45]!==l||t[46]!==s?(J=()=>{if(!l)return;let e=h.current;if(!e)return;let t=fe(r);if(!t)return;if(t.kind!==`selection-offset`){ue(r),t.kind===`outline`?Tt(e,t.detail,r):t.kind===`lint`?Dt(e,t.detail,r):t.kind===`raw-mdx`&&Et(e,t.detail,()=>y.current,r);return}let n=!1,i=null;return queueMicrotask(()=>{if(n)return;let t=fe(r);t?.kind===`selection-offset`&&(i=de({view:e,docName:r,navigation:t,ydoc:s.document,transition:{from:`wysiwyg`,to:`source`}}),i&&ue(r))}),()=>{n=!0,i?.cancel(`mode-flip`)}},Y=[r,l,s],t[44]=r,t[45]=l,t[46]=s,t[47]=J,t[48]=Y):(J=t[47],Y=t[48]),(0,Z.useEffect)(J,Y);let X;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Ct.jsx)(`div`,{ref:p,className:`source-editor h-full pb-3`}),t[49]=X):X=t[49],X}function kt(){return{top:S()}}function At(){return _()}export{Ot as SourceEditor,Et as applyRawMdxNavigation};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,G as r,M as i,Ot as a,U as o,V as s,W as c,fn as l,lt as u,mt as d,pt as f,sn as ee,st as te}from"./DocumentContext-CuOcLr_j.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{A as g,O as ne,S as _,a as re,i as ie,o as ae}from"./CodeMirrorPropInput-ZXKkJFOY.js";import{Do as v,Gi as oe,T as se,_o as y,do as b,ni as x}from"./dist-DKOit9IV2.js";import{n as ce}from"./config-context-BH8hj2sg.js";import{H as S,L as le,M as ue,O as de,P as fe,S as C,d as w,f as pe,i as me,j as he,l as ge,r as _e,t as ve,w as T}from"./typing-burst-detector-Bhy83GCZ.js";import{f as E,g as D}from"./doc-paths-DqOWEocR.js";import{J as O}from"./navigation-targets-jpdo1ZgU.js";import"./config-provider-oAAIxoES.js";import{$ as k,D as A,Dt as j,F as M,It as N,Lt as P,Ot as F,Pt as I,Y as L,Z as R,b as z,ct as B,ft as V,g as H,gt as U,ht as ye,it as W,kt as be,l as G,lt as K,nt as q,pt as J,rt as Y,ut as X,v as xe}from"./dist-SEJoL7zW.js";import{a as Se,n as Ce}from"./cm-theme-Cv1HvKYn.js";import{i as we,n as Te,o as Ee,r as De}from"./dist-BmEWZ9WX.js";import{o as Oe,r as ke}from"./selection-context-CS5s5L53.js";import{l as Ae}from"./lint-config-client-Dwop4dqP.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./dist-ChGC604M.js";import{n as Re,t as ze}from"./src-Dn75jB9p.js";var Z=e(p(),1),Be=h();function Ve(){let e=r();return e===null?null:new Set(e.keys())}function He(e,t,n){let r=[],i=M(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);y.lastIndex=0;for(let e=y.exec(t);e!==null;e=y.exec(t)){let t=e[2];if(!v(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(L.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,c=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&v(l)&&n!=null)return r.push(L.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-o)),!1;let u=s.exec(c);if(u)return r.push(L.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),L.set(r)}function Ue(e){let t=c(e);return t===null?[]:[k.fromClass(class{decorations;constructor(e){this.decorations=He(e.state,e.visibleRanges,Ve())}update(e){(e.docChanged||e.viewportChanged||M(e.startState)!==M(e.state))&&(this.decorations=He(e.view.state,e.view.visibleRanges,Ve()))}},{decorations:e=>e.decorations}),R.domEventHandlers({mousedown(n){let i=n.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=r()?.get(a);return window.location.hash=e===void 0?D():E(O({scope:e.scope,name:a,path:e.path})),!0}let s=n.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(n.preventDefault(),window.location.hash=o(t,e,c),!0)}})]}var We=L.line({attributes:{dir:`auto`}});function Ge(e){let t=new I;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,We),r=n.to+1}return t.finish()}var Ke=k.fromClass(class{decorations;constructor(e){this.decorations=Ge(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Ge(e.view))}},{decorations:e=>e.decorations}),qe=[R.perLineTextDirection.of(!0),Ke],Je=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ye=`cm-lint-local-target`;function Xe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function Ze(e,t){let n=H(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Je.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function Qe(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function $e(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=Ze(e,Xe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:Qe(i.severity),message:T(i),source:`${i.source}/${i.code}`,markClass:Ye})}return r}var et=N.define();function tt(e){let t={findings:[]};return[Me(e=>ne()?$e(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(et)))}),k.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:et.of(null)}),Le(n)},i=C(e,e=>{e.status===`loaded`&&r(e.findings)}),a=g(()=>r(t.findings));return{destroy(){i(),a()}}})]}function nt(e,t){return e.enabled?[Ne(),Me(async n=>rt(n.state.doc,await x(n.state.doc.toString(),e,t)),{delay:600})]:[]}function Q(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function rt(e,t){let n=[];for(let r of t){let t=Q(e,r.range.start),i=Q(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=it(r);o&&(a.actions=[o]),n.push(a)}return n}function it(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:Q(n,e.range.start),to:Q(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var at=[J(),K(),X(),xe(),Y(),W(),be.allowMultipleSelections.of(!0),A(),G(),De(),Te(),U(),q(),B(),je(),V.of([...we,...Ce,...Ie,...z,...Ee,...Fe])],ot=L.mark({class:`cm-link-ref-broken`}),st=/^\s{0,3}\[([^\]]+)\]:\s/,ct=/\[([^\]]*)\]\[([^\]]*)\]/g,lt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function $(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function ut(e){let t=[];return M(e).iterate({enter(e){if(lt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function dt(e){let t=new Set,n=[],r=e.doc,i=ut(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if($(n.from,i))continue;let a=st.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!$(t.from,i)&&!st.test(t.text))for(ct.lastIndex=0;;){let e=ct.exec(t.text);if(!e)break;let r=t.from+e.index;if($(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ot.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),L.set(a)}var ft=P.define({create(e){return dt(e)},update(e,t){return t.docChanged?dt(t.state):e},provide:e=>R.decorations.from(e)}),pt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,mt=L.mark({class:`cm-del`}),ht=L.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),gt=L.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function _t(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function vt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!b.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(b.test(r.text))return{from:t.from,to:r.to}}return null}function yt(e,t){let n=[],r=M(e),i=vt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(mt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=pt.exec(r.text),a=i?i[1].length:2,o=L.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=_t(r.text),a=L.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(ht.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(gt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(gt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),L.set(n)}var bt=class{decorations;constructor(e){this.decorations=yt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||M(e.startState)!==M(e.state))&&(this.decorations=yt(e.view.state,e.view.visibleRanges))}},xt=k.fromClass(bt,{decorations:e=>e.decorations});function St(){return[xt,ft]}var Ct=t(),wt=N.define();function Tt(e,t,n){let r=w(e.state.doc)[t.index];r&&l(n,()=>{e.dispatch({selection:F.cursor(r.from),effects:R.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function Et(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);l(r,()=>{e.dispatch({selection:F.cursor(a),effects:R.scrollIntoView(a,{y:`center`})}),e.focus()})})}function Dt(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);l(n,()=>{e.dispatch({selection:F.cursor(o),effects:R.scrollIntoView(o,{y:`start`})}),e.focus()})}function Ot(e){let t=(0,Be.c)(50),{docName:r,ytext:o,provider:s,placeholder:c,isSourceModeActive:l}=e,p=(0,Z.useRef)(null),h=(0,Z.useRef)(null),[g,ne]=(0,Z.useState)(null);if(g)throw g;let{resolvedTheme:_}=m(),{merged:v}=ce(),y=(0,Z.useRef)(l),b=v?.editor?.wordWrap??!0,{data:x}=Ae(r),S;t[0]!==x?.effective||t[1]!==v?(S=x?.effective??(v?.contentRules?oe(v.contentRules):se),t[0]=x?.effective,t[1]=v,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E,D;t[5]===l?(E=t[6],D=t[7]):(E=()=>{y.current=l},D=[l],t[5]=l,t[6]=E,t[7]=D),(0,Z.useEffect)(E,D);let O=(0,Z.useRef)(null),k;t[8]!==r||t[9]!==C||t[10]!==c||t[11]!==s||t[12]!==_||t[13]!==b||t[14]!==o?(k=()=>{let e=p.current;if(!e)return;let t=s.configuration.name??``,l,m=At;try{l=f({docName:t,container:e,sizeStats:{viewCount:0,bytes:o.length},factory:e=>{let n=null,a=i({ydoc:s.document,ytext:o,docName:t}),l=new j,d=new j,f=new j,p=new j,h=new R({state:be.create({doc:o.toString(),extensions:[at,qe,Pe({scrollToMatch:e=>ee(t)?R.scrollIntoView(e,{y:`start`}):wt.of(null)}),V.of([Se]),ze(o,s.awareness),V.of(Re),...ie({themeCompartment:l,resolvedTheme:_,ydoc:s.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),St(),Ue(t),le(),p.of(nt(C,r)),tt(r),a,R.updateListener.of(e=>{te(e)&&u(t)}),R.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,_e(t,`source`,me(e.view)),ke(t,`source`,Oe(e.view,t))},120))}),f.of(ye(c??``)),R.theme({"&":{height:`100%`}}),R.scrollMargins.of(kt)]}),parent:e});_e(t,`source`,me(h)),ke(t,`source`,Oe(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,m),g.addEventListener(`paste`,m),g.addEventListener(`drop`,m),g.addEventListener(`cut`,m),{view:h,ydoc:s.document,ytext:o,provider:s,themeCompartment:l,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:p}}}),O.current=l,h.current=l.view,a(r,l.view),ve()&&l.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),O.current=null,h.current=null,ne(t instanceof Error?t:Error(String(t)))}return()=>{let e=O.current;e&&(d(e),n(r,e.view)),O.current=null,h.current=null}},t[8]=r,t[9]=C,t[10]=c,t[11]=s,t[12]=_,t[13]=b,t[14]=o,t[15]=k):k=t[15];let A;t[16]!==s||t[17]!==o?(A=[o,s],t[16]=s,t[17]=o,t[18]=A):A=t[18],(0,Z.useEffect)(k,A);let M,N;t[19]===r?(M=t[20],N=t[21]):(M=()=>{},N=[r],t[19]=r,t[20]=M,t[21]=N),(0,Z.useEffect)(M,N);let P,F;t[22]===_?(P=t[23],F=t[24]):(F=()=>{let e=O.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?re:ae)})},P=[_],t[22]=_,t[23]=P,t[24]=F),(0,Z.useEffect)(F,P);let I,L;t[25]===b?(I=t[26],L=t[27]):(I=()=>{let e=O.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?R.lineWrapping:[])})},L=[b],t[25]=b,t[26]=I,t[27]=L),(0,Z.useEffect)(I,L);let z,B;t[28]===c?(z=t[29],B=t[30]):(z=()=>{let e=O.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ye(c??``))})},B=[c],t[28]=c,t[29]=z,t[30]=B),(0,Z.useEffect)(z,B);let H;t[31]!==r||t[32]!==C?(H=()=>{let e=O.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(nt(C,r))})},t[31]=r,t[32]=C,t[33]=H):H=t[33];let U;t[34]===T?U=t[35]:(U=[T],t[34]=T,t[35]=U),(0,Z.useEffect)(H,U);let W,G;t[36]!==r||t[37]!==l?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==r||t.mode!==`source`||!l)return;let n=h.current;n&&(Tt(n,t,r),he(r))};return window.addEventListener(ge,e),()=>window.removeEventListener(ge,e)},G=[r,l],t[36]=r,t[37]=l,t[38]=W,t[39]=G):(W=t[38],G=t[39]),(0,Z.useEffect)(W,G);let K,q;t[40]!==r||t[41]!==l?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==r||!l)return;let n=h.current;n&&(Dt(n,t,r),he(r))};return window.addEventListener(pe,e),()=>window.removeEventListener(pe,e)},q=[r,l],t[40]=r,t[41]=l,t[42]=K,t[43]=q):(K=t[42],q=t[43]),(0,Z.useEffect)(K,q);let J,Y;t[44]!==r||t[45]!==l||t[46]!==s?(J=()=>{if(!l)return;let e=h.current;if(!e)return;let t=fe(r);if(!t)return;if(t.kind!==`selection-offset`){ue(r),t.kind===`outline`?Tt(e,t.detail,r):t.kind===`lint`?Dt(e,t.detail,r):t.kind===`raw-mdx`&&Et(e,t.detail,()=>y.current,r);return}let n=!1,i=null;return queueMicrotask(()=>{if(n)return;let t=fe(r);t?.kind===`selection-offset`&&(i=de({view:e,docName:r,navigation:t,ydoc:s.document,transition:{from:`wysiwyg`,to:`source`}}),i&&ue(r))}),()=>{n=!0,i?.cancel(`mode-flip`)}},Y=[r,l,s],t[44]=r,t[45]=l,t[46]=s,t[47]=J,t[48]=Y):(J=t[47],Y=t[48]),(0,Z.useEffect)(J,Y);let X;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Ct.jsx)(`div`,{ref:p,className:`source-editor h-full pb-3`}),t[49]=X):X=t[49],X}function kt(){return{top:S()}}function At(){return _()}export{Ot as SourceEditor,Et as applyRawMdxNavigation};
|