@inkeep/open-knowledge 0.66.1 → 0.66.2
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-Bk3Dz297.mjs → acp-harness-probe-C-bmwKC0.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-m3Xu5_Pm.mjs +2 -0
- package/dist/{git-handle-C9RPCwJN.mjs → git-handle-CehgIzoK.mjs} +2 -2
- package/dist/git-handle-DEJ8aYeH.mjs +1 -0
- package/dist/index.mjs +2 -2
- package/dist/init-CkmKaAE9.mjs +1 -0
- package/dist/{init-DNQN84w4.mjs → init-DwE-82L_.mjs} +3 -3
- package/dist/{launch-json-removal-CsfA7Q9t.mjs → launch-json-removal-C5njpRMR.mjs} +2 -2
- package/dist/{loader-DOE8T0bD.mjs → loader-Da9QChC_.mjs} +2 -2
- package/dist/loader-Dt_OoEGe.mjs +1 -0
- package/dist/md-manager-BZCd3Vha.mjs +2 -0
- package/dist/{open-browser-Bzfc84xQ.mjs → open-browser-DIMVmm0o.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-Doha4cmP.mjs → preview-BBdR6vmw.mjs} +2 -2
- package/dist/preview-oAaqMEbf.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-xON2KhOz.js → ActivityModeContent-B37XJHxx.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-CC1Bimpt.js → AddPropertiesButton-eMa8eBGf.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-BPGzdN_g.js → AgentDiffPane-DHlBPg3c.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-Sg80UfOQ.js → AgentThreadClientBinder-lpLw9XDN.js} +1 -1
- package/dist/public/assets/{BugReportHistory-BOcChnxP.js → BugReportHistory-CuN8iDlA.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-BgcEcCCO.js → BugReportHistoryDialog-DGj_pTZf.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-Dp0ghtC3.js → CodeMirrorPropInput-Be4UuxHJ.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-DQlUb8Vu.js → ConsentDialogBody-XPmv8PGk.js} +1 -1
- package/dist/public/assets/{DocumentContext-Ak51fAXi.js → DocumentContext-CZ1LyjXH.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-DpkS50Z0.js → EditorModeToggle-jAYPDv4d.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-DyPeGiVT.js → EnableSyncConfirmDialog-DGwynRzU.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-BKndnS9g.js → ExcalidrawDocEditor-BWNQPfhq.js} +1 -1
- package/dist/public/assets/FeedbackForm-BAO3lafp.js +1 -0
- package/dist/public/assets/{GraphPanel-BdWJsnt-.js → GraphPanel-DDKxNmOr.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-C5f6Lj0b.js → ImportSkillDialog-D_3ApyBv.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-C21DnP0H.js → LintConfigEditor-B3Gj07cI.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-CV1Prpoj.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-Dd9YEu9g.js → ManagedArtifactProperties-DeYta-00.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-CftOutDD.js → MermaidDocEditor-CiHzMRN9.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-B3tLCY9W.js → PropertyDisplayRow-sm9qwuBw.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-DRDozPGc.js → ReportBugDialogBody-DZA9GXnC.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-Sbn4B06b.js → ReportBugMenuTrigger-D4qlc7zz.js} +2 -2
- package/dist/public/assets/{SchemaConfigEditor-DXhpWbEp.js → SchemaConfigEditor-D17w4XxC.js} +1 -1
- package/dist/public/assets/{SessionsHost-CGbrz5ge.js → SessionsHost-Cl-gIFYH.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-GRqpQyOX.js → SettingsDialogBody-Cqc-yl4k.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-DgKD1FWp.js → ShareBranchSwitchDialog-Ct4sBRfQ.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-BsGWPO5t.js → ShareReceiveDialog-B92aqQEx.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DX4YDzpC.js → ShareReceiveMissDialog-C9VJyG_D.js} +1 -1
- package/dist/public/assets/{SkillCostValue-B4D7Ysdc.js → SkillCostValue-DLUxO68c.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-BruoXTh-.js → SkillEditBanner-b0gL75iO.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-QBcuRLjh.js → SkillInstallMenu-BwbbztKY.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-Dshp1Rdi.js → SkillOriginInline-DpPKdpar.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-BCXxl3_M.js → SkillToolbarControls-Bap6lIv8.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-CJxgVynH.js → SlidesToolbarControls-BNqlGZ8e.js} +1 -1
- package/dist/public/assets/{SourceEditor-D9_q6g5_.js → SourceEditor-RCKX4Ohe.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Lt1-XHX1.js → TerminalPanel-Zo-UDi-u.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-VUZguLdJ.js → TerminalWindowApp-DjRpidld.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Cb7BPpJA.js → TextDocEditor--IKVxg88.js} +1 -1
- package/dist/public/assets/{ThreadView-Bf53-ggV.js → ThreadView-CUArcRSL.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-B1HLCcW9.js → TimelineDiffPane-D8HcBg2n.js} +1 -1
- package/dist/public/assets/{agent-diff-store-XWhp_hqN.js → agent-diff-store-DgFkR0kV.js} +1 -1
- package/dist/public/assets/{auth-state-cache-D22yWCCz.js → auth-state-cache-DNrEadrI.js} +1 -1
- package/dist/public/assets/{bug-report-send-manager-BBNXam8A.js → bug-report-send-manager-5nrn8Psu.js} +1 -1
- package/dist/public/assets/{client-version-B_H8duw7.js → client-version-DewpIoVp.js} +1 -1
- package/dist/public/assets/{comment-chips-D0prCEAx.js → comment-chips-mYvhrkxj.js} +1 -1
- package/dist/public/assets/{config-provider-D-Y4Wg0x.js → config-provider-DWieljqa.js} +1 -1
- package/dist/public/assets/{dist-D1GzYuCD.js → dist-As2x8uCt.js} +1 -1
- package/dist/public/assets/{doc-paths-ByyIE836.js → doc-paths-BkNaaTOB.js} +1 -1
- package/dist/public/assets/{documents-events-DPqTvBXn.js → documents-events-2g_OBjKU.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-Ccbih42A.js → file-tree-adapter-Q4uvZiQM.js} +1 -1
- package/dist/public/assets/{file-tree-utils-Jz2v-e9t.js → file-tree-utils-Cy2QEG_5.js} +1 -1
- package/dist/public/assets/{folder-config-api-BddKQIga.js → folder-config-api-DhiWnWlS.js} +1 -1
- package/dist/public/assets/i18n-CpxzRV_v.js +1 -0
- package/dist/public/assets/{index-nJnxhQRq.js → index-DrzqbmWI.js} +7 -7
- package/dist/public/assets/{launcher-selection-CUAKUPGW.js → launcher-selection-DTBWt8s2.js} +1 -1
- package/dist/public/assets/{lint-config-client-DeGP10La.js → lint-config-client-CQNYXMfG.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-Bir8KkrK.js → markdownlint-rule-browser-BTovNATK.js} +1 -1
- package/dist/public/assets/{page-list-cache-D2OX_WDU.js → page-list-cache-AR7XhC2q.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-sErL2uzl.js → pending-receive-nav-store-DXWRYoc_.js} +1 -1
- package/dist/public/assets/{progress-DfDRMpm4.js → progress-YLRB2n7w.js} +1 -1
- package/dist/public/assets/{project-paths-DX_YsFET.js → project-paths-BmMTa57i.js} +1 -1
- package/dist/public/assets/{prop-types-NHOECtyl.js → prop-types-CTZ-Zcfm.js} +1 -1
- package/dist/public/assets/{receive-store-6Dih24L8.js → receive-store-RexqPtVU.js} +1 -1
- package/dist/public/assets/{selection-context-C95IJZrT.js → selection-context-BcWEVrAI.js} +1 -1
- package/dist/public/assets/{skill-scope-4RF9DbEf.js → skill-scope-CauFSzAn.js} +1 -1
- package/dist/public/assets/{skills-api-D5W0J2dk.js → skills-api-KE9J-94z.js} +1 -1
- package/dist/public/assets/{src-qGi8ucyG.js → src-B5LNuYlK.js} +1 -1
- package/dist/public/assets/{startup-marks-Bvho0uc6.js → startup-marks-CUyZjhyC.js} +1 -1
- package/dist/public/assets/{tag-pill-input-CtA1wFQO.js → tag-pill-input-CcAyDLGe.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-BFUFQkcA.js → target-navigation-intent-D6pgYTG-.js} +1 -1
- package/dist/public/assets/{telemetry-startup-C_zn8gFF.js → telemetry-startup-BFCbpnFp.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-ZGFW9kw3.js → terminal-cli-display-C2L3vHWw.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B0lg7vla.js → typing-burst-detector-BO09cycJ.js} +1 -1
- package/dist/public/assets/{uninstall-BkDWS7iv.js → uninstall-DJhzaTa1.js} +1 -1
- package/dist/public/assets/{use-activity-panel-CuqTH-mx.js → use-activity-panel-BCJavN8T.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-Ba8Smkdy.js → use-apply-config-color-theme-CwClEWrd.js} +1 -1
- package/dist/public/assets/{use-collab-url-DFpuF-wX.js → use-collab-url-DHOOSaDb.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-c1fyCaal.js → use-live-xterm-theme-_zomIp7z.js} +1 -1
- package/dist/public/assets/{use-open-skill-DJmjKHgr.js → use-open-skill-DzG96lKz.js} +1 -1
- package/dist/public/assets/{use-settings-route-BQW0aTo0.js → use-settings-route-Dq3eM_ye.js} +1 -1
- package/dist/public/assets/{use-skill-origin-WyyVjfzt.js → use-skill-origin-uUY8unvE.js} +1 -1
- package/dist/public/assets/{use-skills-BOMFaoLg.js → use-skills-RpG-BeVz.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-T9hbZCmo.js → use-terminal-enabled-DIQ4qqYj.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-Blkn7mx5.js → use-timeline-entry-diff-_fLA4Pt0.js} +1 -1
- package/dist/public/assets/{use-workspace-BeSzHXgL.js → use-workspace-DRylP9vX.js} +1 -1
- package/dist/public/index.html +47 -47
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-AsKV5LiF.mjs → repair-launch-json-DO_3ABvq.mjs} +2 -2
- package/dist/{repair-mcp-configs-BYASBYNt.mjs → repair-mcp-configs-Bmw9_91L.mjs} +2 -2
- package/dist/{repair-skills-AGXJVKE-.mjs → repair-skills-BftHPTbX.mjs} +2 -2
- package/dist/repair-skills-CPy4iDny.mjs +1 -0
- package/dist/{resolve-project-root-XrNPFGNY.mjs → resolve-project-root-BCdGoKNz.mjs} +2 -2
- package/dist/{server-lock-DaOXwt6C.mjs → server-lock-CBDjdfxH.mjs} +2 -2
- package/dist/server-lock-xg5Njzvf.mjs +1 -0
- package/dist/{skill-teardown-BEnDXQv2.mjs → skill-teardown-Bxy5NV-V.mjs} +2 -2
- package/dist/src-B13TeG7U.mjs +1 -0
- package/dist/{src-BUfAkcnU.mjs → src-CP2xsmg5.mjs} +2 -2
- package/dist/{src-Gpb82U0M.mjs → src-D4A03H49.mjs} +2 -2
- package/dist/{src-D79M3x9g.mjs → src-DXJo3hyx.mjs} +1 -1
- package/dist/{src-Dyk9iCzv.mjs → src-HFlqeGnA.mjs} +4 -4
- package/dist/{start-hZ8_kSuC.mjs → start-7t3OZSc5.mjs} +3 -3
- package/dist/start-C1hXUjiR.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-DXEhJ197.mjs +0 -2
- package/dist/git-handle-pDdbSsMj.mjs +0 -1
- package/dist/init-D9KKXAfB.mjs +0 -1
- package/dist/loader-hcc6a20d.mjs +0 -1
- package/dist/md-manager-BUn7RZOJ.mjs +0 -2
- package/dist/preview-CHdEIdwL.mjs +0 -1
- package/dist/public/assets/FeedbackForm-BNeQXmJD.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-AGHZbLhh.js +0 -1
- package/dist/public/assets/i18n-BFtoQNCd.js +0 -1
- package/dist/repair-skills-DUxV_xLI.mjs +0 -1
- package/dist/server-lock-VtTnds5h.mjs +0 -1
- package/dist/src-s7hpfSip.mjs +0 -1
- package/dist/start-ky9sRyOI.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-Cym3gapE.js";import{a as ee,c as te,i as s,n as ne,o as re,s as ie,t as ae}from"./dialog-CTNat3T_.js";import{n as c}from"./dist-CJhtNlOm2.js";import{t as l}from"./desktop-bridge-types-oYPdTDmz.js";import{n as u,t as oe}from"./git-branch-3CSRgL0o.js";import{t as d}from"./spinner-t7GahFcQ.js";import{n as se,t as f}from"./miss-dialog-store-DVpIaq34.js";import{r as p,t as m}from"./auth-prompt-store-3WR-Jv7J.js";import{a as h,n as g}from"./receive-store-6Dih24L8.js";import{t as ce}from"./share-metadata-rows-DPgPU-ev.js";var _=e(n(),1),le=a();function ue(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 de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function v(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 fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ge(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function _e(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ve(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 ye(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=v(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 be(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,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var y=t();function xe(e){return l(e.repositoryTarget)}function Se(e,t=l(e.target)){let n=e.contentRootDepth===null?t:[...xe(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 Ce(e){return e!==null&&e.kind===`project-branch-switch`}function b(e){let t=(0,le.c)(217),{bridge:n,store:a}=e,m=a===void 0?g:a,{_:v}=i(),b=(0,_.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[x,S]=(0,_.useState)(fe),Me=(0,_.useRef)(!1),Ne=(0,_.useRef)(!1),Pe=(0,_.useRef)(!1),Fe=(0,_.useRef)(null),Ie;t[0]===b?Ie=t[1]:(Ie=Ce(b)?b:null,t[0]=b,t[1]=Ie);let C=Ie,Le;t[2]!==v||t[3]!==C?.share.target.kind?(Le=C?.share.target.kind===`folder`?v({id:`ugoTXs`}):v({id:`XH30C4`}),t[2]=v,t[3]=C?.share.target.kind,t[4]=Le):Le=t[4];let w=Le,Re;t[5]===C?Re=t[6]:(Re=()=>{S(fe),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=C},t[5]=C,t[6]=Re);let ze;t[7]===b?ze=t[8]:(ze=[b],t[7]=b,t[8]=ze),(0,_.useEffect)(Re,ze);let Be;t[9]!==C||t[10]!==n?(Be=()=>{if(!C||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.repositoryTarget.kind,path:xe(C.share)}).then(t=>{e||S(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),S(Ae))}),()=>{e=!0}},t[9]=C,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===C?Ve=t[13]:(Ve=[C],t[12]=C,t[13]=Ve),(0,_.useEffect)(Be,Ve);let He;t[14]!==C||t[15]!==x.info||t[16]!==x.phase||t[17]!==n?(He=()=>{if(!C||x.phase!==`ready`||Pe.current||!ge(x.info))return;Pe.current=!0,S(_e);let e=C;n.project.fetchTargetStatus({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.target.kind,path:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth}}).then(t=>{Fe.current===e&&S(e=>ve(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),S(ke))})},t[14]=C,t[15]=x.info,t[16]=x.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==C||t[20]!==x.phase?(Ue=[x.phase,C],t[19]=C,t[20]=x.phase,t[21]=Ue):Ue=t[21],(0,_.useEffect)(He,Ue);let We;t[22]!==C||t[23]!==x.phase||t[24]!==x.resolution||t[25]!==m?(We=()=>{if(x.phase!==`verdict`)return;let{kind:e}=x.resolution;e!==`deleted`&&e!==`never-on-branch`||C&&(f.arm({kind:C.share.target.kind,path:l(C.share.target),repositoryPath:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth},branch:C.share.branch}),m.dismiss())},t[22]=C,t[23]=x.phase,t[24]=x.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==C||t[28]!==x||t[29]!==m?(Ge=[x,C,m],t[27]=C,t[28]=x,t[29]=m,t[30]=Ge):Ge=t[30],(0,_.useEffect)(We,Ge);let Ke;t[31]!==x.phase||t[32]!==x.resolution?(Ke=()=>{x.phase===`verdict`&&console.log(h({verdict_cell:x.resolution.kind}))},t[31]=x.phase,t[32]=x.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===x?qe=t[35]:(qe=[x],t[34]=x,t[35]=qe),(0,_.useEffect)(Ke,qe);let Je;t[36]!==v||t[37]!==C||t[38]!==x.pendingDoc||t[39]!==x.phase||t[40]!==n||t[41]!==m||t[42]!==w?(Je=()=>{if(x.phase!==`awaiting-cc1-recycle`||!C)return;let e=C.share.branch,t=x.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:C.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(h({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:C.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(C.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),c.error(v({id:`gQV-9w`,values:{targetNoun:w}}))}),m.dismiss();return}console.log(h({branch_dialog_action:`branch-switch-timeout`,branch:e})),c.error(v({id:`LBwUR6`,values:{targetNoun:w}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),c.error(v({id:`Jw6EC4`,values:{targetNoun:w}})),m.dismiss())}),()=>{r=!0}},t[36]=v,t[37]=C,t[38]=x.pendingDoc,t[39]=x.phase,t[40]=n,t[41]=m,t[42]=w,t[43]=Je):Je=t[43];let Ye;if(t[44]!==C||t[45]!==x.phase?(Ye=[x.phase,C],t[44]=C,t[45]=x.phase,t[46]=Ye):Ye=t[46],(0,_.useEffect)(Je,Ye),!C)return null;let{share:T,projectPath:E,currentBranch:Xe}=C,D=T.branch,Ze;t[47]!==v||t[48]!==n.project||t[49]!==E||t[50]!==D||t[51]!==m?(Ze=function(e,t,r){console.log(h({branch_dialog_action:`switch`,branch_action:`switch`,branch:D,verdict_cell:r})),S(t=>me(t,e)),n.project.runCheckout(t?{projectPath:E,branch:D,fastForward:!0}:{projectPath:E,branch:D}).then(e=>{let t=null,n=!1;S(r=>{let{state:i,sideEffect:a}=ye(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?c.error(v({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?c.error(v({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&c.error(v({id:`c863eW`,values:{shareBranch:D}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),S(Oe),c.error(v({id:`c863eW`,values:{shareBranch:D}}))})},t[47]=v,t[48]=n.project,t[49]=E,t[50]=D,t[51]=m,t[52]=Ze):Ze=t[52];let O=Ze,Qe;t[53]!==x.info||t[54]!==x.phase||t[55]!==O||t[56]!==T.target?(Qe=function(){x.phase===`ready`&&ue(x.info).switchEnabled&&O(l(T.target),!1)},t[53]=x.info,t[54]=x.phase,t[55]=O,t[56]=T.target,t[57]=Qe):Qe=t[57];let $e=Qe,et;t[58]!==x.phase||t[59]!==x.resolution||t[60]!==O||t[61]!==T.target?(et=function(){x.phase===`verdict`&&O(l(T.target),!0,x.resolution.kind)},t[58]=x.phase,t[59]=x.resolution,t[60]=O,t[61]=T.target,t[62]=et):et=t[62];let tt=et,nt;t[63]!==x.phase||t[64]!==x.resolution||t[65]!==O?(nt=function(){x.phase===`verdict`&&x.resolution.kind===`renamed`&&O(x.resolution.renamedTo,!0,x.resolution.kind)},t[63]=x.phase,t[64]=x.resolution,t[65]=O,t[66]=nt):nt=t[66];let rt=nt,it;t[67]!==x.phase||t[68]!==x.resolution||t[69]!==O||t[70]!==T.target?(it=function(){x.phase===`verdict`&&O(l(T.target),!1,x.resolution.kind)},t[67]=x.phase,t[68]=x.resolution,t[69]=O,t[70]=T.target,t[71]=it):it=t[71];let at=it,ot;t[72]!==v||t[73]!==n.project||t[74]!==E||t[75]!==T||t[76]!==D||t[77]!==m||t[78]!==w?(ot=function(){console.log(h({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),c.error(v({id:`b5aNbi`,values:{targetNoun:w}}))}),m.dismiss()},t[72]=v,t[73]=n.project,t[74]=E,t[75]=T,t[76]=D,t[77]=m,t[78]=w,t[79]=ot):ot=t[79];let st=ot,ct;t[80]!==v||t[81]!==D?(ct=function(e,t){let{helper:n,authFailed:r,notFoundAsIdentity:i}=t===void 0?{}:t;if(e===`fetch-failed`&&i){c.error(v({id:`jRsjlF`}));return}if(e===`fetch-failed`&&r){c.error(v({id:`gfb-CM`}),{action:{label:v({id:`5lWFkC`}),onClick:De}});return}switch(e){case`helper-not-found`:{let e=n??v({id:`cHhH3i`});c.error(v({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:c.error(v({id:`NJyQi_`,values:{shareBranch:D}}));return;case`fetch-failed`:c.error(v({id:`bWLmRK`}));return;case`already-checked-out`:c.error(v({id:`ljHjfg`}));return;case`branch-exists`:c.error(v({id:`h3QZcB`,values:{shareBranch:D}}));return;case`path-exists`:c.error(v({id:`cN1Gcp`,values:{shareBranch:D}}));return;case`no-git`:c.error(v({id:`CFnavk`}));return;case`empty-repo`:c.error(v({id:`5IgYAM`}));return;case`invalid-branch`:c.error(v({id:`JfPuv7`,values:{shareBranch:D}}));return;case`proxy-null`:case`error`:c.error(v({id:`e8zYa8`,values:{shareBranch:D}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=v,t[81]=D,t[82]=ct):ct=t[82];let lt=ct,ut;t[83]!==v||t[84]!==n.project||t[85]!==T||t[86]!==D||t[87]!==lt||t[88]!==m?(ut=function(e){let t=null,r,i,a,o=!1,ee=null;if(S(n=>{let{state:te,sideEffect:s}=be(n,e);return s&&(t=s.reason,r=s.helper,i=s.authFailed,a=s.notFoundAsIdentity,o=te.phase===`dismissed`),te.phase===`opening-worktree`&&(ee=te.path),te}),t!==null&&(console.log(h({branch_dialog_action:`open-worktree-failed:${t}`,branch:D})),lt(t,{helper:r,authFailed:i,notFoundAsIdentity:a})),ee!==null){p();let e=ee;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),c.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}o&&m.dismiss()},t[83]=v,t[84]=n.project,t[85]=T,t[86]=D,t[87]=lt,t[88]=m,t[89]=ut):ut=t[89];let dt=ut,ft;t[90]!==dt||t[91]!==x.phase||t[92]!==n.worktree||t[93]!==D?(ft=function(){x.phase===`ready`&&(console.log(h({branch_dialog_action:`open-worktree`,branch:D})),S(he),n.worktree.checkout({branch:D}).then(e=>{dt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),dt(null)}))},t[90]=dt,t[91]=x.phase,t[92]=n.worktree,t[93]=D,t[94]=ft):ft=t[94];let pt=ft,mt;t[95]!==v||t[96]!==x.otherWorktreePath||t[97]!==x.phase||t[98]!==n.project||t[99]!==T||t[100]!==D||t[101]!==m?(mt=function(){if(x.phase!==`branch-in-other-worktree`)return;let e=x.otherWorktreePath;console.log(h({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),c.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=v,t[96]=x.otherWorktreePath,t[97]=x.phase,t[98]=n.project,t[99]=T,t[100]=D,t[101]=m,t[102]=mt):mt=t[102];let ht=mt,gt;t[103]!==x.phase||t[104]!==x.resolution||t[105]!==m?(gt=function(){console.log(h({branch_dialog_action:`cancel`,verdict_cell:x.phase===`verdict`?x.resolution.kind:void 0})),m.dismiss()},t[103]=x.phase,t[104]=x.resolution,t[105]=m,t[106]=gt):gt=t[106];let k=gt,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J;if(t[107]!==v||t[108]!==x.info||t[109]!==x.otherWorktreePath||t[110]!==x.phase||t[111]!==x.resolution||t[112]!==k||t[113]!==Xe||t[114]!==T.branch||t[115]!==T.owner||t[116]!==T.repo||t[117]!==T.target||t[118]!==D||t[119]!==w){q=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?ue(x.info):null;let e;t[139]!==x.info||t[140]!==x.phase||t[141]!==Xe?(e=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?de(x.info):Xe??`HEAD`,t[139]=x.info,t[140]=x.phase,t[141]=Xe,t[142]=e):e=t[142];let n=e;I=x.phase===`switching`||x.phase===`awaiting-cc1-recycle`,N=x.phase===`creating-worktree`;let i;t[143]===v?i=t[144]:(i=v({id:`OuY8t9`}),t[143]=v,t[144]=i),P=i;let a;t[145]===v?a=t[146]:(a=v({id:`XZkdtg`}),t[145]=v,t[146]=a),F=a;let o;t[147]===v?o=t[148]:(o=v({id:`VTulZj`}),t[147]=v,t[148]=o),J=o;let re=x.phase===`loading`,c=x.phase===`error`;M=ae,G=!0,t[149]===k?K=t[150]:(K=e=>{e||k()},t[149]=k,t[150]=K),j=s,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Ee,U=Te;let u;t[151]===w?u=t[152]:(u=(0,y.jsx)(te,{children:(0,y.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:w}})}),t[151]=w,t[152]=u);let oe=T.owner,se=T.repo,f;t[153]===T.target?f=t[154]:(f=l(T.target),t[153]=T.target,t[154]=f);let p;t[155]!==T.owner||t[156]!==T.repo||t[157]!==f?(p=(0,y.jsx)(ee,{className:`sr-only`,children:(0,y.jsx)(r,{id:`f8jU-L`,values:{0:oe,1:se,2:f}})}),t[155]=T.owner,t[156]=T.repo,t[157]=f,t[158]=p):p=t[158],t[159]!==u||t[160]!==p?(W=(0,y.jsxs)(ie,{children:[u,p]}),t[159]=u,t[160]=p,t[161]=W):W=t[161],A=ne;let m=T.owner,h=T.repo,g;t[162]===T.target?g=t[163]:(g=l(T.target),t[162]=T.target,t[163]=g),t[164]!==T.branch||t[165]!==T.owner||t[166]!==T.repo||t[167]!==T.target.kind||t[168]!==g?(L=(0,y.jsx)(`div`,{className:`mb-4`,children:(0,y.jsx)(ce,{owner:m,repo:h,path:g,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=T.branch,t[165]=T.owner,t[166]=T.repo,t[167]=T.target.kind,t[168]=g,t[169]=L):L=t[169],R=x.phase===`branch-in-other-worktree`?(0,y.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,y.jsx)(`p`,{className:`leading-6`,children:(0,y.jsx)(r,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,y.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:x.otherWorktreePath})]}):x.phase===`verdict-pending`?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,y.jsx)(r,{id:`Uay5NL`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`renamed`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,y.jsx)(r,{id:`P0HC30`,values:{0:x.resolution.renamedTo,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`diverged`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,y.jsx)(r,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):re?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`jerqF0`})]}):c?(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,y.jsx)(r,{id:`w4hMYl`})}):q?.kind===`D`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`DTI-fp`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`_902BE`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,y.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,y.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,y.jsx)(r,{id:`n2lRue`})}),(0,y.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(we)})]}):null,t[107]=v,t[108]=x.info,t[109]=x.otherWorktreePath,t[110]=x.phase,t[111]=x.resolution,t[112]=k,t[113]=Xe,t[114]=T.branch,t[115]=T.owner,t[116]=T.repo,t[117]=T.target,t[118]=D,t[119]=w,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]=J}else A=t[120],j=t[121],M=t[122],N=t[123],P=t[124],F=t[125],I=t[126],L=t[127],R=t[128],z=t[129],B=t[130],V=t[131],H=t[132],U=t[133],W=t[134],G=t[135],K=t[136],q=t[137],J=t[138];let Y;t[170]===I?Y=t[171]:(Y=I?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=I,t[171]=Y);let X;t[172]===N?X=t[173]:(X=N?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=N,t[173]=X);let Z;t[174]!==A||t[175]!==L||t[176]!==R||t[177]!==z||t[178]!==Y||t[179]!==X?(Z=(0,y.jsxs)(A,{children:[L,R,z,Y,X]}),t[174]=A,t[175]=L,t[176]=R,t[177]=z,t[178]=Y,t[179]=X,t[180]=Z):Z=t[180];let _t;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,y.jsx)(r,{id:`dEgA5A`}),t[181]=_t):_t=t[181];let Q;t[182]===k?Q=t[183]:(Q=(0,y.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:k,"data-testid":`share-branch-switch-cancel`,children:_t}),t[182]=k,t[183]=Q);let vt;t[184]!==x.phase||t[185]!==x.resolution||t[186]!==N||t[187]!==st||t[188]!==rt||t[189]!==pt||t[190]!==ht||t[191]!==at||t[192]!==$e||t[193]!==tt||t[194]!==P||t[195]!==F||t[196]!==I||t[197]!==q||t[198]!==J?(vt=x.phase===`branch-in-other-worktree`?(0,y.jsx)(o,{onClick:ht,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,y.jsx)(r,{id:`hyCxJY`})}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsxs)(o,{onClick:tt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`uA_jXp`})]}):x.resolution.kind===`renamed`?(0,y.jsxs)(o,{onClick:rt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`AItsE5`})]}):x.resolution.kind===`diverged`?(0,y.jsxs)(o,{onClick:at,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,y.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:[q?.openCurrentEnabled?(0,y.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:st,disabled:I||N,"data-testid":`share-branch-switch-open-current`,children:[(0,y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,y.jsx)(o,{variant:`outline`,onClick:$e,disabled:!q?.switchEnabled||I||N,"aria-disabled":!q?.switchEnabled||I||N,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),F]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),F]})}),(0,y.jsx)(o,{onClick:pt,disabled:!q||I||N,"data-testid":`share-branch-switch-worktree`,children:N?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),J]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),J]})})]}),t[184]=x.phase,t[185]=x.resolution,t[186]=N,t[187]=st,t[188]=rt,t[189]=pt,t[190]=ht,t[191]=at,t[192]=$e,t[193]=tt,t[194]=P,t[195]=F,t[196]=I,t[197]=q,t[198]=J,t[199]=vt):vt=t[199];let yt;t[200]!==Q||t[201]!==vt?(yt=(0,y.jsxs)(re,{className:`sm:justify-between`,children:[Q,vt]}),t[200]=Q,t[201]=vt,t[202]=yt):yt=t[202];let $;t[203]!==j||t[204]!==B||t[205]!==V||t[206]!==H||t[207]!==U||t[208]!==W||t[209]!==Z||t[210]!==yt?($=(0,y.jsxs)(j,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Z,yt]}),t[203]=j,t[204]=B,t[205]=V,t[206]=H,t[207]=U,t[208]=W,t[209]=Z,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==M||t[213]!==G||t[214]!==K||t[215]!==$?(bt=(0,y.jsx)(M,{open:G,onOpenChange:K,children:$}),t[212]=M,t[213]=G,t[214]=K,t[215]=$,t[216]=bt):bt=t[216],bt}function we(e){return(0,y.jsx)(`li`,{children:(0,y.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Te(e){e.preventDefault()}function Ee(e){e.preventDefault()}function De(){return m.request()}function Oe(e){return ye(e,null).state}function ke(e){return ve(e,null)}function Ae(e){return pe(e,null)}function je(){return null}export{b 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-Cym3gapE.js";import{a as ee,c as te,i as s,n as ne,o as re,s as ie,t as ae}from"./dialog-CTNat3T_.js";import{n as c}from"./dist-CJhtNlOm2.js";import{t as l}from"./desktop-bridge-types-oYPdTDmz.js";import{n as u,t as oe}from"./git-branch-3CSRgL0o.js";import{t as d}from"./spinner-t7GahFcQ.js";import{n as se,t as f}from"./miss-dialog-store-DVpIaq34.js";import{r as p,t as m}from"./auth-prompt-store-3WR-Jv7J.js";import{a as h,n as g}from"./receive-store-RexqPtVU.js";import{t as ce}from"./share-metadata-rows-DPgPU-ev.js";var _=e(n(),1),le=a();function ue(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 de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function v(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 fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ge(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function _e(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ve(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 ye(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=v(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 be(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,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var y=t();function xe(e){return l(e.repositoryTarget)}function Se(e,t=l(e.target)){let n=e.contentRootDepth===null?t:[...xe(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 Ce(e){return e!==null&&e.kind===`project-branch-switch`}function b(e){let t=(0,le.c)(217),{bridge:n,store:a}=e,m=a===void 0?g:a,{_:v}=i(),b=(0,_.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[x,S]=(0,_.useState)(fe),Me=(0,_.useRef)(!1),Ne=(0,_.useRef)(!1),Pe=(0,_.useRef)(!1),Fe=(0,_.useRef)(null),Ie;t[0]===b?Ie=t[1]:(Ie=Ce(b)?b:null,t[0]=b,t[1]=Ie);let C=Ie,Le;t[2]!==v||t[3]!==C?.share.target.kind?(Le=C?.share.target.kind===`folder`?v({id:`ugoTXs`}):v({id:`XH30C4`}),t[2]=v,t[3]=C?.share.target.kind,t[4]=Le):Le=t[4];let w=Le,Re;t[5]===C?Re=t[6]:(Re=()=>{S(fe),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=C},t[5]=C,t[6]=Re);let ze;t[7]===b?ze=t[8]:(ze=[b],t[7]=b,t[8]=ze),(0,_.useEffect)(Re,ze);let Be;t[9]!==C||t[10]!==n?(Be=()=>{if(!C||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.repositoryTarget.kind,path:xe(C.share)}).then(t=>{e||S(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),S(Ae))}),()=>{e=!0}},t[9]=C,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===C?Ve=t[13]:(Ve=[C],t[12]=C,t[13]=Ve),(0,_.useEffect)(Be,Ve);let He;t[14]!==C||t[15]!==x.info||t[16]!==x.phase||t[17]!==n?(He=()=>{if(!C||x.phase!==`ready`||Pe.current||!ge(x.info))return;Pe.current=!0,S(_e);let e=C;n.project.fetchTargetStatus({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.target.kind,path:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth}}).then(t=>{Fe.current===e&&S(e=>ve(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),S(ke))})},t[14]=C,t[15]=x.info,t[16]=x.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==C||t[20]!==x.phase?(Ue=[x.phase,C],t[19]=C,t[20]=x.phase,t[21]=Ue):Ue=t[21],(0,_.useEffect)(He,Ue);let We;t[22]!==C||t[23]!==x.phase||t[24]!==x.resolution||t[25]!==m?(We=()=>{if(x.phase!==`verdict`)return;let{kind:e}=x.resolution;e!==`deleted`&&e!==`never-on-branch`||C&&(f.arm({kind:C.share.target.kind,path:l(C.share.target),repositoryPath:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth},branch:C.share.branch}),m.dismiss())},t[22]=C,t[23]=x.phase,t[24]=x.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==C||t[28]!==x||t[29]!==m?(Ge=[x,C,m],t[27]=C,t[28]=x,t[29]=m,t[30]=Ge):Ge=t[30],(0,_.useEffect)(We,Ge);let Ke;t[31]!==x.phase||t[32]!==x.resolution?(Ke=()=>{x.phase===`verdict`&&console.log(h({verdict_cell:x.resolution.kind}))},t[31]=x.phase,t[32]=x.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===x?qe=t[35]:(qe=[x],t[34]=x,t[35]=qe),(0,_.useEffect)(Ke,qe);let Je;t[36]!==v||t[37]!==C||t[38]!==x.pendingDoc||t[39]!==x.phase||t[40]!==n||t[41]!==m||t[42]!==w?(Je=()=>{if(x.phase!==`awaiting-cc1-recycle`||!C)return;let e=C.share.branch,t=x.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:C.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(h({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:C.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(C.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),c.error(v({id:`gQV-9w`,values:{targetNoun:w}}))}),m.dismiss();return}console.log(h({branch_dialog_action:`branch-switch-timeout`,branch:e})),c.error(v({id:`LBwUR6`,values:{targetNoun:w}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),c.error(v({id:`Jw6EC4`,values:{targetNoun:w}})),m.dismiss())}),()=>{r=!0}},t[36]=v,t[37]=C,t[38]=x.pendingDoc,t[39]=x.phase,t[40]=n,t[41]=m,t[42]=w,t[43]=Je):Je=t[43];let Ye;if(t[44]!==C||t[45]!==x.phase?(Ye=[x.phase,C],t[44]=C,t[45]=x.phase,t[46]=Ye):Ye=t[46],(0,_.useEffect)(Je,Ye),!C)return null;let{share:T,projectPath:E,currentBranch:Xe}=C,D=T.branch,Ze;t[47]!==v||t[48]!==n.project||t[49]!==E||t[50]!==D||t[51]!==m?(Ze=function(e,t,r){console.log(h({branch_dialog_action:`switch`,branch_action:`switch`,branch:D,verdict_cell:r})),S(t=>me(t,e)),n.project.runCheckout(t?{projectPath:E,branch:D,fastForward:!0}:{projectPath:E,branch:D}).then(e=>{let t=null,n=!1;S(r=>{let{state:i,sideEffect:a}=ye(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?c.error(v({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?c.error(v({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&c.error(v({id:`c863eW`,values:{shareBranch:D}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),S(Oe),c.error(v({id:`c863eW`,values:{shareBranch:D}}))})},t[47]=v,t[48]=n.project,t[49]=E,t[50]=D,t[51]=m,t[52]=Ze):Ze=t[52];let O=Ze,Qe;t[53]!==x.info||t[54]!==x.phase||t[55]!==O||t[56]!==T.target?(Qe=function(){x.phase===`ready`&&ue(x.info).switchEnabled&&O(l(T.target),!1)},t[53]=x.info,t[54]=x.phase,t[55]=O,t[56]=T.target,t[57]=Qe):Qe=t[57];let $e=Qe,et;t[58]!==x.phase||t[59]!==x.resolution||t[60]!==O||t[61]!==T.target?(et=function(){x.phase===`verdict`&&O(l(T.target),!0,x.resolution.kind)},t[58]=x.phase,t[59]=x.resolution,t[60]=O,t[61]=T.target,t[62]=et):et=t[62];let tt=et,nt;t[63]!==x.phase||t[64]!==x.resolution||t[65]!==O?(nt=function(){x.phase===`verdict`&&x.resolution.kind===`renamed`&&O(x.resolution.renamedTo,!0,x.resolution.kind)},t[63]=x.phase,t[64]=x.resolution,t[65]=O,t[66]=nt):nt=t[66];let rt=nt,it;t[67]!==x.phase||t[68]!==x.resolution||t[69]!==O||t[70]!==T.target?(it=function(){x.phase===`verdict`&&O(l(T.target),!1,x.resolution.kind)},t[67]=x.phase,t[68]=x.resolution,t[69]=O,t[70]=T.target,t[71]=it):it=t[71];let at=it,ot;t[72]!==v||t[73]!==n.project||t[74]!==E||t[75]!==T||t[76]!==D||t[77]!==m||t[78]!==w?(ot=function(){console.log(h({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),c.error(v({id:`b5aNbi`,values:{targetNoun:w}}))}),m.dismiss()},t[72]=v,t[73]=n.project,t[74]=E,t[75]=T,t[76]=D,t[77]=m,t[78]=w,t[79]=ot):ot=t[79];let st=ot,ct;t[80]!==v||t[81]!==D?(ct=function(e,t){let{helper:n,authFailed:r,notFoundAsIdentity:i}=t===void 0?{}:t;if(e===`fetch-failed`&&i){c.error(v({id:`jRsjlF`}));return}if(e===`fetch-failed`&&r){c.error(v({id:`gfb-CM`}),{action:{label:v({id:`5lWFkC`}),onClick:De}});return}switch(e){case`helper-not-found`:{let e=n??v({id:`cHhH3i`});c.error(v({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:c.error(v({id:`NJyQi_`,values:{shareBranch:D}}));return;case`fetch-failed`:c.error(v({id:`bWLmRK`}));return;case`already-checked-out`:c.error(v({id:`ljHjfg`}));return;case`branch-exists`:c.error(v({id:`h3QZcB`,values:{shareBranch:D}}));return;case`path-exists`:c.error(v({id:`cN1Gcp`,values:{shareBranch:D}}));return;case`no-git`:c.error(v({id:`CFnavk`}));return;case`empty-repo`:c.error(v({id:`5IgYAM`}));return;case`invalid-branch`:c.error(v({id:`JfPuv7`,values:{shareBranch:D}}));return;case`proxy-null`:case`error`:c.error(v({id:`e8zYa8`,values:{shareBranch:D}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=v,t[81]=D,t[82]=ct):ct=t[82];let lt=ct,ut;t[83]!==v||t[84]!==n.project||t[85]!==T||t[86]!==D||t[87]!==lt||t[88]!==m?(ut=function(e){let t=null,r,i,a,o=!1,ee=null;if(S(n=>{let{state:te,sideEffect:s}=be(n,e);return s&&(t=s.reason,r=s.helper,i=s.authFailed,a=s.notFoundAsIdentity,o=te.phase===`dismissed`),te.phase===`opening-worktree`&&(ee=te.path),te}),t!==null&&(console.log(h({branch_dialog_action:`open-worktree-failed:${t}`,branch:D})),lt(t,{helper:r,authFailed:i,notFoundAsIdentity:a})),ee!==null){p();let e=ee;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),c.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}o&&m.dismiss()},t[83]=v,t[84]=n.project,t[85]=T,t[86]=D,t[87]=lt,t[88]=m,t[89]=ut):ut=t[89];let dt=ut,ft;t[90]!==dt||t[91]!==x.phase||t[92]!==n.worktree||t[93]!==D?(ft=function(){x.phase===`ready`&&(console.log(h({branch_dialog_action:`open-worktree`,branch:D})),S(he),n.worktree.checkout({branch:D}).then(e=>{dt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),dt(null)}))},t[90]=dt,t[91]=x.phase,t[92]=n.worktree,t[93]=D,t[94]=ft):ft=t[94];let pt=ft,mt;t[95]!==v||t[96]!==x.otherWorktreePath||t[97]!==x.phase||t[98]!==n.project||t[99]!==T||t[100]!==D||t[101]!==m?(mt=function(){if(x.phase!==`branch-in-other-worktree`)return;let e=x.otherWorktreePath;console.log(h({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),c.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=v,t[96]=x.otherWorktreePath,t[97]=x.phase,t[98]=n.project,t[99]=T,t[100]=D,t[101]=m,t[102]=mt):mt=t[102];let ht=mt,gt;t[103]!==x.phase||t[104]!==x.resolution||t[105]!==m?(gt=function(){console.log(h({branch_dialog_action:`cancel`,verdict_cell:x.phase===`verdict`?x.resolution.kind:void 0})),m.dismiss()},t[103]=x.phase,t[104]=x.resolution,t[105]=m,t[106]=gt):gt=t[106];let k=gt,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J;if(t[107]!==v||t[108]!==x.info||t[109]!==x.otherWorktreePath||t[110]!==x.phase||t[111]!==x.resolution||t[112]!==k||t[113]!==Xe||t[114]!==T.branch||t[115]!==T.owner||t[116]!==T.repo||t[117]!==T.target||t[118]!==D||t[119]!==w){q=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?ue(x.info):null;let e;t[139]!==x.info||t[140]!==x.phase||t[141]!==Xe?(e=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?de(x.info):Xe??`HEAD`,t[139]=x.info,t[140]=x.phase,t[141]=Xe,t[142]=e):e=t[142];let n=e;I=x.phase===`switching`||x.phase===`awaiting-cc1-recycle`,N=x.phase===`creating-worktree`;let i;t[143]===v?i=t[144]:(i=v({id:`OuY8t9`}),t[143]=v,t[144]=i),P=i;let a;t[145]===v?a=t[146]:(a=v({id:`XZkdtg`}),t[145]=v,t[146]=a),F=a;let o;t[147]===v?o=t[148]:(o=v({id:`VTulZj`}),t[147]=v,t[148]=o),J=o;let re=x.phase===`loading`,c=x.phase===`error`;M=ae,G=!0,t[149]===k?K=t[150]:(K=e=>{e||k()},t[149]=k,t[150]=K),j=s,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Ee,U=Te;let u;t[151]===w?u=t[152]:(u=(0,y.jsx)(te,{children:(0,y.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:w}})}),t[151]=w,t[152]=u);let oe=T.owner,se=T.repo,f;t[153]===T.target?f=t[154]:(f=l(T.target),t[153]=T.target,t[154]=f);let p;t[155]!==T.owner||t[156]!==T.repo||t[157]!==f?(p=(0,y.jsx)(ee,{className:`sr-only`,children:(0,y.jsx)(r,{id:`f8jU-L`,values:{0:oe,1:se,2:f}})}),t[155]=T.owner,t[156]=T.repo,t[157]=f,t[158]=p):p=t[158],t[159]!==u||t[160]!==p?(W=(0,y.jsxs)(ie,{children:[u,p]}),t[159]=u,t[160]=p,t[161]=W):W=t[161],A=ne;let m=T.owner,h=T.repo,g;t[162]===T.target?g=t[163]:(g=l(T.target),t[162]=T.target,t[163]=g),t[164]!==T.branch||t[165]!==T.owner||t[166]!==T.repo||t[167]!==T.target.kind||t[168]!==g?(L=(0,y.jsx)(`div`,{className:`mb-4`,children:(0,y.jsx)(ce,{owner:m,repo:h,path:g,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=T.branch,t[165]=T.owner,t[166]=T.repo,t[167]=T.target.kind,t[168]=g,t[169]=L):L=t[169],R=x.phase===`branch-in-other-worktree`?(0,y.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,y.jsx)(`p`,{className:`leading-6`,children:(0,y.jsx)(r,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,y.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:x.otherWorktreePath})]}):x.phase===`verdict-pending`?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,y.jsx)(r,{id:`Uay5NL`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`renamed`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,y.jsx)(r,{id:`P0HC30`,values:{0:x.resolution.renamedTo,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`diverged`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,y.jsx)(r,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):re?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`jerqF0`})]}):c?(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,y.jsx)(r,{id:`w4hMYl`})}):q?.kind===`D`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`DTI-fp`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`_902BE`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,y.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,y.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,y.jsx)(r,{id:`n2lRue`})}),(0,y.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(we)})]}):null,t[107]=v,t[108]=x.info,t[109]=x.otherWorktreePath,t[110]=x.phase,t[111]=x.resolution,t[112]=k,t[113]=Xe,t[114]=T.branch,t[115]=T.owner,t[116]=T.repo,t[117]=T.target,t[118]=D,t[119]=w,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]=J}else A=t[120],j=t[121],M=t[122],N=t[123],P=t[124],F=t[125],I=t[126],L=t[127],R=t[128],z=t[129],B=t[130],V=t[131],H=t[132],U=t[133],W=t[134],G=t[135],K=t[136],q=t[137],J=t[138];let Y;t[170]===I?Y=t[171]:(Y=I?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=I,t[171]=Y);let X;t[172]===N?X=t[173]:(X=N?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=N,t[173]=X);let Z;t[174]!==A||t[175]!==L||t[176]!==R||t[177]!==z||t[178]!==Y||t[179]!==X?(Z=(0,y.jsxs)(A,{children:[L,R,z,Y,X]}),t[174]=A,t[175]=L,t[176]=R,t[177]=z,t[178]=Y,t[179]=X,t[180]=Z):Z=t[180];let _t;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,y.jsx)(r,{id:`dEgA5A`}),t[181]=_t):_t=t[181];let Q;t[182]===k?Q=t[183]:(Q=(0,y.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:k,"data-testid":`share-branch-switch-cancel`,children:_t}),t[182]=k,t[183]=Q);let vt;t[184]!==x.phase||t[185]!==x.resolution||t[186]!==N||t[187]!==st||t[188]!==rt||t[189]!==pt||t[190]!==ht||t[191]!==at||t[192]!==$e||t[193]!==tt||t[194]!==P||t[195]!==F||t[196]!==I||t[197]!==q||t[198]!==J?(vt=x.phase===`branch-in-other-worktree`?(0,y.jsx)(o,{onClick:ht,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,y.jsx)(r,{id:`hyCxJY`})}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsxs)(o,{onClick:tt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`uA_jXp`})]}):x.resolution.kind===`renamed`?(0,y.jsxs)(o,{onClick:rt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`AItsE5`})]}):x.resolution.kind===`diverged`?(0,y.jsxs)(o,{onClick:at,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,y.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:[q?.openCurrentEnabled?(0,y.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:st,disabled:I||N,"data-testid":`share-branch-switch-open-current`,children:[(0,y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,y.jsx)(o,{variant:`outline`,onClick:$e,disabled:!q?.switchEnabled||I||N,"aria-disabled":!q?.switchEnabled||I||N,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),F]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),F]})}),(0,y.jsx)(o,{onClick:pt,disabled:!q||I||N,"data-testid":`share-branch-switch-worktree`,children:N?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),J]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),J]})})]}),t[184]=x.phase,t[185]=x.resolution,t[186]=N,t[187]=st,t[188]=rt,t[189]=pt,t[190]=ht,t[191]=at,t[192]=$e,t[193]=tt,t[194]=P,t[195]=F,t[196]=I,t[197]=q,t[198]=J,t[199]=vt):vt=t[199];let yt;t[200]!==Q||t[201]!==vt?(yt=(0,y.jsxs)(re,{className:`sm:justify-between`,children:[Q,vt]}),t[200]=Q,t[201]=vt,t[202]=yt):yt=t[202];let $;t[203]!==j||t[204]!==B||t[205]!==V||t[206]!==H||t[207]!==U||t[208]!==W||t[209]!==Z||t[210]!==yt?($=(0,y.jsxs)(j,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Z,yt]}),t[203]=j,t[204]=B,t[205]=V,t[206]=H,t[207]=U,t[208]=W,t[209]=Z,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==M||t[213]!==G||t[214]!==K||t[215]!==$?(bt=(0,y.jsx)(M,{open:G,onOpenChange:K,children:$}),t[212]=M,t[213]=G,t[214]=K,t[215]=$,t[216]=bt):bt=t[216],bt}function we(e){return(0,y.jsx)(`li`,{children:(0,y.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Te(e){e.preventDefault()}function Ee(e){e.preventDefault()}function De(){return m.request()}function Oe(e){return ye(e,null).state}function ke(e){return ve(e,null)}function Ae(e){return pe(e,null)}function je(){return null}export{b as ShareBranchSwitchDialog};
|
package/dist/public/assets/{ShareReceiveDialog-BsGWPO5t.js → ShareReceiveDialog-B92aqQEx.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-Cym3gapE.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-CTNat3T_.js";import{Mn as u,kn as d}from"./dist-D1GzYuCD.js";import{n as f}from"./dist-CJhtNlOm2.js";import{t as p}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ie}from"./spinner-t7GahFcQ.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-6Dih24L8.js";import{t as se}from"./share-metadata-rows-DPgPU-ev.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(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 C(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 w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return{kind:e.target.kind,path:p(e.target),repositoryPath:p(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function D(e){return e!==null&&e.kind===`launcher-consent`}function O(e){return e!==null&&e.kind===`launcher-miss`}function k(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,j),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(A));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=O(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=D(o)?o:null,t[6]=o,t[7]=d);let p=d??u;if(!p)return null;let ie;return t[8]!==p||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(ie=(0,T.jsx)(M,{payload:p,bridge:n,cloneController:r,store:a},ee),t[8]=p,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=ie):ie=t[13],ie}function A(e){return e+1}function j(){return null}function M(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[M,pe]=(0,v.useState)(!1),[N,me]=(0,v.useState)(!1),[P,he]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),ge=(0,v.useRef)(!1),_e=(0,v.useRef)(null),ve,ye;t[0]===P?(ve=t[1],ye=t[2]):(ve=()=>{P&&_e.current?.focus()},ye=[P],t[0]=P,t[1]=ve,t[2]=ye),(0,v.useEffect)(ve,ye);let be;t[3]!==F||t[4]!==n?(be=()=>{D(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,repositoryPath:p(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=be):be=t[5];let xe;t[6]===n?xe=t[7]:(xe=[n],t[6]=n,t[7]=xe),(0,v.useEffect)(be,xe);let Se;t[8]!==A||t[9]!==h||t[10]!==n?(Se=()=>{if(!h||!O(n)||A!==null||ge.current)return;ge.current=!0,pe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{j(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),j({authenticated:!1,host:e})}).finally(()=>{pe(!1)})},t[8]=A,t[9]=h,t[10]=n,t[11]=Se):Se=t[11];let Ce;t[12]!==A||t[13]!==n?(Ce=[n,A],t[12]=A,t[13]=n,t[14]=Ce):Ce=t[14],(0,v.useEffect)(Se,Ce);let L=O(n)?n:null,we=D(n)?n:null,R=L?.share??we?.share??null,z,Te,B,V,H,Ee,U,W;if(t[15]!==x||t[16]!==M||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){U=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],W=n,B=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;he(null),me(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),me(!1),he({detail:t instanceof Error?t.message:String(t)});return}if(me(!1),n.kind===`error`){he({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:E(L.share)}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==M||t[38]!==h?(i=async function(){if(!(!h||M)){pe(!0);try{let e=await h.startSignIn();pe(!1),e!==null&&j(e)}catch(e){let t=e;pe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=M,t[38]=h,t[39]=i):i=t[39],H=i,V=async function(){if(!(!L||!e||w)){he(null),k(!0),console.log(ae({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(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.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=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:E(L.share)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}k(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(fe),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(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}),I(de),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(ue),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===W?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[50]=W,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.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]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],U=ue;break bb0}if(!L||!R||!e){U=null;break bb0}z=h!==void 0&&!N;let D;t[103]!==x||t[104]!==N?(D=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=D):D=t[105],Te=D,Ee=d(e)}t[15]=x,t[16]=M,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=Te,t[27]=B,t[28]=V,t[29]=H,t[30]=Ee,t[31]=U,t[32]=W}else z=t[25],Te=t[26],B=t[27],V=t[28],H=t[29],Ee=t[30],U=t[31],W=t[32];if(U!==Symbol.for(`react.early_return_sentinel`))return U;let De=Ee,Oe=A?.authenticated?A.login:void 0,ke;t[106]===P?ke=t[107]:(ke=P?.detail?m(P.detail):``,t[106]=P,t[107]=ke);let Ae=ke,G;t[108]===_?G=t[109]:(G=e=>{e||_.dismiss()},t[108]=_,t[109]=G);let K;t[110]===W?K=t[111]:(K=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[110]=W,t[111]=K);let q;t[112]===R.target?q=t[113]:(q=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=q);let J;t[114]!==R.owner||t[115]!==R.repo||t[116]!==q?(J=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,q]}),t[114]=R.owner,t[115]=R.repo,t[116]=q,t[117]=J):J=t[117];let je=R.owner,Me=R.repo,Y;t[118]===R.target?Y=t[119]:(Y=p(R.target),t[118]=R.target,t[119]=Y);let X;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==Y?(X=(0,T.jsx)(se,{owner:je,repo:Me,path:Y,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=Y,t[125]=X):X=t[125];let Z;t[126]!==K||t[127]!==J||t[128]!==X?(Z=(0,T.jsxs)(c,{children:[K,J,X]}),t[126]=K,t[127]=J,t[128]=X,t[129]=Z):Z=t[129];let Q;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Ae||t[134]!==Te||t[135]!==N||t[136]!==B||t[137]!==V||t[138]!==w?(Q=P?(0,T.jsxs)(`div`,{ref:_e,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),Ae?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ae,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.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,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{B()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{V()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.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:()=>{B()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:Te}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.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:()=>{V()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Ae,t[134]=Te,t[135]=N,t[136]=B,t[137]=V,t[138]=w,t[139]=Q):Q=t[139];let Ne;t[140]!==M||t[141]!==A||t[142]!==h||t[143]!==H||t[144]!==Oe?(Ne=h?(0,T.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:A===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):A.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Oe},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.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:()=>{H()},disabled:M,children:M?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=M,t[141]=A,t[142]=h,t[143]=H,t[144]=Oe,t[145]=Ne):Ne=t[145];let Pe;t[146]!==P||t[147]!==De?(Pe=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:De},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=De,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Q||t[150]!==Ne||t[151]!==Pe?(Fe=(0,T.jsxs)(re,{children:[Q,Ne,Pe]}),t[149]=Q,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===_?Ie=t[154]:(Ie=()=>_.dismiss(),t[153]=_,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==Z||t[159]!==Fe||t[160]!==Re?($=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Z,Fe,Re]}),t[158]=Z,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==G||t[163]!==$?(ze=(0,T.jsx)(l,{open:!0,onOpenChange:G,children:$}),t[162]=G,t[163]=$,t[164]=ze):ze=t[164],ze}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function ue(e){return e===null?e:w(e)}function de(e){return e===null?e:C(e,{ok:!0})}function fe(e){return e===null?e:x(e)}export{k 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-Cym3gapE.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-CTNat3T_.js";import{Mn as u,kn as d}from"./dist-As2x8uCt.js";import{n as f}from"./dist-CJhtNlOm2.js";import{t as p}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ie}from"./spinner-t7GahFcQ.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-RexqPtVU.js";import{t as se}from"./share-metadata-rows-DPgPU-ev.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(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 C(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 w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return{kind:e.target.kind,path:p(e.target),repositoryPath:p(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function D(e){return e!==null&&e.kind===`launcher-consent`}function O(e){return e!==null&&e.kind===`launcher-miss`}function k(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,j),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(A));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=O(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=D(o)?o:null,t[6]=o,t[7]=d);let p=d??u;if(!p)return null;let ie;return t[8]!==p||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(ie=(0,T.jsx)(M,{payload:p,bridge:n,cloneController:r,store:a},ee),t[8]=p,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=ie):ie=t[13],ie}function A(e){return e+1}function j(){return null}function M(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[M,pe]=(0,v.useState)(!1),[N,me]=(0,v.useState)(!1),[P,he]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),ge=(0,v.useRef)(!1),_e=(0,v.useRef)(null),ve,ye;t[0]===P?(ve=t[1],ye=t[2]):(ve=()=>{P&&_e.current?.focus()},ye=[P],t[0]=P,t[1]=ve,t[2]=ye),(0,v.useEffect)(ve,ye);let be;t[3]!==F||t[4]!==n?(be=()=>{D(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,repositoryPath:p(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=be):be=t[5];let xe;t[6]===n?xe=t[7]:(xe=[n],t[6]=n,t[7]=xe),(0,v.useEffect)(be,xe);let Se;t[8]!==A||t[9]!==h||t[10]!==n?(Se=()=>{if(!h||!O(n)||A!==null||ge.current)return;ge.current=!0,pe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{j(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),j({authenticated:!1,host:e})}).finally(()=>{pe(!1)})},t[8]=A,t[9]=h,t[10]=n,t[11]=Se):Se=t[11];let Ce;t[12]!==A||t[13]!==n?(Ce=[n,A],t[12]=A,t[13]=n,t[14]=Ce):Ce=t[14],(0,v.useEffect)(Se,Ce);let L=O(n)?n:null,we=D(n)?n:null,R=L?.share??we?.share??null,z,Te,B,V,H,Ee,U,W;if(t[15]!==x||t[16]!==M||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){U=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],W=n,B=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;he(null),me(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),me(!1),he({detail:t instanceof Error?t.message:String(t)});return}if(me(!1),n.kind===`error`){he({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:E(L.share)}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==M||t[38]!==h?(i=async function(){if(!(!h||M)){pe(!0);try{let e=await h.startSignIn();pe(!1),e!==null&&j(e)}catch(e){let t=e;pe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=M,t[38]=h,t[39]=i):i=t[39],H=i,V=async function(){if(!(!L||!e||w)){he(null),k(!0),console.log(ae({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(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.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=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:E(L.share)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}k(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(fe),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(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}),I(de),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(ue),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===W?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[50]=W,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.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]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],U=ue;break bb0}if(!L||!R||!e){U=null;break bb0}z=h!==void 0&&!N;let D;t[103]!==x||t[104]!==N?(D=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=D):D=t[105],Te=D,Ee=d(e)}t[15]=x,t[16]=M,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=Te,t[27]=B,t[28]=V,t[29]=H,t[30]=Ee,t[31]=U,t[32]=W}else z=t[25],Te=t[26],B=t[27],V=t[28],H=t[29],Ee=t[30],U=t[31],W=t[32];if(U!==Symbol.for(`react.early_return_sentinel`))return U;let De=Ee,Oe=A?.authenticated?A.login:void 0,ke;t[106]===P?ke=t[107]:(ke=P?.detail?m(P.detail):``,t[106]=P,t[107]=ke);let Ae=ke,G;t[108]===_?G=t[109]:(G=e=>{e||_.dismiss()},t[108]=_,t[109]=G);let K;t[110]===W?K=t[111]:(K=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[110]=W,t[111]=K);let q;t[112]===R.target?q=t[113]:(q=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=q);let J;t[114]!==R.owner||t[115]!==R.repo||t[116]!==q?(J=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,q]}),t[114]=R.owner,t[115]=R.repo,t[116]=q,t[117]=J):J=t[117];let je=R.owner,Me=R.repo,Y;t[118]===R.target?Y=t[119]:(Y=p(R.target),t[118]=R.target,t[119]=Y);let X;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==Y?(X=(0,T.jsx)(se,{owner:je,repo:Me,path:Y,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=Y,t[125]=X):X=t[125];let Z;t[126]!==K||t[127]!==J||t[128]!==X?(Z=(0,T.jsxs)(c,{children:[K,J,X]}),t[126]=K,t[127]=J,t[128]=X,t[129]=Z):Z=t[129];let Q;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Ae||t[134]!==Te||t[135]!==N||t[136]!==B||t[137]!==V||t[138]!==w?(Q=P?(0,T.jsxs)(`div`,{ref:_e,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),Ae?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ae,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.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,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{B()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{V()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.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:()=>{B()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:Te}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.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:()=>{V()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Ae,t[134]=Te,t[135]=N,t[136]=B,t[137]=V,t[138]=w,t[139]=Q):Q=t[139];let Ne;t[140]!==M||t[141]!==A||t[142]!==h||t[143]!==H||t[144]!==Oe?(Ne=h?(0,T.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:A===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):A.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Oe},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.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:()=>{H()},disabled:M,children:M?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=M,t[141]=A,t[142]=h,t[143]=H,t[144]=Oe,t[145]=Ne):Ne=t[145];let Pe;t[146]!==P||t[147]!==De?(Pe=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:De},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=De,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Q||t[150]!==Ne||t[151]!==Pe?(Fe=(0,T.jsxs)(re,{children:[Q,Ne,Pe]}),t[149]=Q,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===_?Ie=t[154]:(Ie=()=>_.dismiss(),t[153]=_,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==Z||t[159]!==Fe||t[160]!==Re?($=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Z,Fe,Re]}),t[158]=Z,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==G||t[163]!==$?(ze=(0,T.jsx)(l,{open:!0,onOpenChange:G,children:$}),t[162]=G,t[163]=$,t[164]=ze):ze=t[164],ze}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function ue(e){return e===null?e:w(e)}function de(e){return e===null?e:C(e,{ok:!0})}function fe(e){return e===null?e:x(e)}export{k as ShareReceiveDialog};
|
package/dist/public/assets/{ShareReceiveMissDialog-DX4YDzpC.js → ShareReceiveMissDialog-C9VJyG_D.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{c as i,i as a,n as o,s,t as c}from"./dialog-CTNat3T_.js";import{a as l,i as u,n as d,o as f,r as p}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{c as i,i as a,n as o,s,t as c}from"./dialog-CTNat3T_.js";import{a as l,i as u,n as d,o as f,r as p}from"./pending-receive-nav-store-DXWRYoc_.js";import{t as m}from"./miss-dialog-store-DVpIaq34.js";import{f as h,p as g}from"./doc-paths-BkNaaTOB.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)(m.subscribe,m.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}=f(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){m.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(l(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){p.arm(d(n,e)),window.location.hash=n.kind===`folder`?g(e):h(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)(s,{children:(0,y.jsx)(i,{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)(u,{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)(o,{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)(c,{open:!0,onOpenChange:D,children:(0,y.jsxs)(a,{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{i,n as a,r as o,t as s}from"./tooltip-DttaCTqz.js";import{dt as c}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{i,n as a,r as o,t as s}from"./tooltip-DttaCTqz.js";import{dt as c}from"./dist-As2x8uCt.js";import{t as l}from"./triangle-alert-GeclLtDN.js";var u=r(),d=e();function f(e){return e<1e3?`${e}`:`${Math.round(e/100)/10}k`}function p(e){let t=(0,u.c)(33),{tokens:r,budget:c}=e,{_:p}=n(),m=c!==void 0&&r>c,h,g,_,v,y,b,x,S;if(t[0]!==p||t[1]!==c||t[2]!==m||t[3]!==r){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c===void 0?``:f(c),n=m||void 0,u=m?`text-amber-600 dark:text-amber-500`:void 0,C;t[12]===r?C=t[13]:(C=f(r),t[12]=r,t[13]=C);let w=m?(0,d.jsx)(`span`,{role:`img`,"aria-label":p({id:`nem6R7`,values:{budgetLabel:e}}),children:(0,d.jsx)(l,{className:`ms-0.5 inline size-3 align-[-0.1em]`,"aria-hidden":`true`})}):null,T;t[14]!==n||t[15]!==u||t[16]!==C||t[17]!==w?(T=(0,d.jsxs)(`span`,{"data-over-budget":n,className:u,children:[C,w]}),t[14]=n,t[15]=u,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E=T;if(!m){S=E;break bb0}_=o,g=s,t[19]===E?x=t[20]:(x=(0,d.jsx)(i,{asChild:!0,children:E}),t[19]=E,t[20]=x),h=a,v=`right`,y=`max-w-xs`,b=p({id:`JsHvhz`,values:{budgetLabel:e}})}t[0]=p,t[1]=c,t[2]=m,t[3]=r,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=S}else h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[21]!==h||t[22]!==v||t[23]!==y||t[24]!==b?(C=(0,d.jsx)(h,{side:v,className:y,children:b}),t[21]=h,t[22]=v,t[23]=y,t[24]=b,t[25]=C):C=t[25];let w;t[26]!==g||t[27]!==x||t[28]!==C?(w=(0,d.jsxs)(g,{children:[x,C]}),t[26]=g,t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==_||t[31]!==w?(T=(0,d.jsx)(_,{children:w}),t[30]=_,t[31]=w,t[32]=T):T=t[32],T}function m(e){let n=(0,u.c)(22),{size:r}=e,i=r.alwaysOn+r.onTrigger+r.onDemand,a;n[0]===r.alwaysOn?a=n[1]:(a=(0,d.jsx)(p,{tokens:r.alwaysOn,budget:100}),n[0]=r.alwaysOn,n[1]=a);let o;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,d.jsx)(t,{id:`eTsJYJ`}),n[2]=o):o=n[2];let s;n[3]===a?s=n[4]:(s=(0,d.jsxs)(`span`,{children:[a,` `,o]}),n[3]=a,n[4]=s);let l;n[5]===r.onTrigger?l=n[6]:(l=(0,d.jsxs)(`span`,{children:[(0,d.jsx)(p,{tokens:r.onTrigger,budget:c}),` SKILL.md`]}),n[5]=r.onTrigger,n[6]=l);let f;n[7]===r.onDemand?f=n[8]:(f=(0,d.jsx)(p,{tokens:r.onDemand}),n[7]=r.onDemand,n[8]=f);let m;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,d.jsx)(t,{id:`ae9Ozt`}),n[9]=m):m=n[9];let h;n[10]===f?h=n[11]:(h=(0,d.jsxs)(`span`,{children:[f,` `,m]}),n[10]=f,n[11]=h);let g;n[12]===i?g=n[13]:(g=(0,d.jsx)(p,{tokens:i}),n[12]=i,n[13]=g);let _;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,d.jsx)(t,{id:`ONchxy`}),n[14]=_):_=n[14];let v;n[15]===g?v=n[16]:(v=(0,d.jsxs)(`span`,{className:`text-foreground/80`,children:[g,` `,_]}),n[15]=g,n[16]=v);let y;return n[17]!==v||n[18]!==s||n[19]!==l||n[20]!==h?(y=(0,d.jsxs)(`span`,{"data-testid":`skill-cost-value`,className:`flex flex-col gap-0.5 font-mono text-[13px] text-muted-foreground`,children:[s,l,h,v]}),n[17]=v,n[18]=s,n[19]=l,n[20]=h,n[21]=y):y=n[21],y}export{f as n,m 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-CBGVrQUa.js";import{s 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-CBGVrQUa.js";import{s as i}from"./skill-scope-CauFSzAn.js";import{t as a}from"./SkillModeBanner-Cfij5biF.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{er as n}from"./DocumentContext-Ak51fAXi.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{r as c}from"./clipboard-adapter-815RzzoI.js";import{t as l}from"./button-Cym3gapE.js";import{i as u,n as d,t as f}from"./tooltip-DttaCTqz.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-D9BtoYXB.js";import{a as b,c as x,d as S,f as C,l as w,p as T,r as E,s as D,u as O}from"./terminal-cli-display-ZGFW9kw3.js";import{a as k,d as A,f as j,i as M,n as N,o as P,p as F,u as I}from"./dropdown-menu-CRvS0_4-.js";import{f as L}from"./RegisteredAgentIcon-CDl1h-4U.js";import{Jt as R,Xt as z,po as B,ri as ee}from"./dist-D1GzYuCD.js";import{n as V}from"./dist-CJhtNlOm2.js";import{c as te}from"./documents-events-DPqTvBXn.js";import{t as H}from"./createLucideIcon-BulbvLvN.js";import{c as U}from"./use-open-skill-DJmjKHgr.js";import{t as ne}from"./spinner-t7GahFcQ.js";import{N as W,S as re,j as G,x as K}from"./skills-api-D5W0J2dk.js";import{i as ie,l as ae,n as oe,r as q}from"./skill-scope-4RF9DbEf.js";import{t as J}from"./use-skills-BOMFaoLg.js";var Y=t(),X=e(r(),1),Z=o(),se=3100,ce=3;function le(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??ce;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var ue={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}},de=[`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 fe(e,t={}){let n=t.rng??Math.random,r=t.colors??de,i=ue[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 pe=1.8,me=90,he=16,ge=380,_e=.025,ve=.1,ye=.18,be=400,xe=9.2736,Se=18.1799,Ce=14.5244,we={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Te(e,t){let{halfWidth:n,apexLift:r}=we[t];return`M${e-n} ${Ce+.3} Q${e} ${Ce-r}, ${e+n} ${Ce+.3}`}function Ee(e){let t=1.5,n=.3;return`M${e-t} ${Ce-n} Q${e} ${Ce+1.4}, ${e+t} ${Ce-n}`}var De=15,Oe=15;function ke(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 Ae(e){let t=(0,Z.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,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.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,X.useRef)(v),[b,x]=(0,X.useState)(0),[S,C]=(0,X.useState)(0),[w,T]=(0,X.useState)(0),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[1]=E):E=t[1];let[D,O]=(0,X.useState)(E),k=(0,X.useRef)(0),A=(0,X.useRef)(0),j=(0,X.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=le(b,t),r=b===3&&e-k.current<3100,i=n===3&&r;n===3&&u?.(),x(n),C(Ie),i||(O(fe(n)),n===3&&(k.current=e,T(Fe))),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},se)},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,X.useEffect)(F,I);let L,R;t[8]!==m||t[9]!==M?(L=()=>{m===0||M||(x(3),C(Pe),O(fe(3)),k.current=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),T(Ne),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},se))},R=[m,M],t[8]=m,t[9]=M,t[10]=L,t[11]=R):(L=t[10],R=t[11]),(0,X.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/ge)),C=-Math.max(-1,Math.min(1,b/ge))*he,w=S*he,T=0,E=0;if(x>=1){let e=Math.min(x/me,1)*pe;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)*ve,i+=(w-i)*ve,u.style.transform=`perspective(${be}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*ye,o+=(E-o)*ye;let O=i*_e,k=-r*_e,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,X.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,X.useLayoutEffect)(ee);let V=b>0,te=V?b:1,H=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`,W=`body-${S}`,re=M&&`ok-blob-sleeping`,G;t[19]!==H||t[20]!==re?(G=s(`ok-blob-group`,re,H),t[19]=H,t[20]=re,t[21]=G):G=t[21];let K;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Y.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 oe;t[25]===ae?oe=t[26]:(oe=(0,Y.jsx)(`ellipse`,{cx:xe,cy:Ce,rx:1.2722,ry:1.9083,className:ae}),t[25]=ae,t[26]=oe);let q=(V||M)&&`ok-blob-eye-hidden`,J;t[27]===q?J=t[28]:(J=s(`ok-blob-eye ok-blob-eye-right`,q),t[27]=q,t[28]=J);let ce;t[29]===J?ce=t[30]:(ce=(0,Y.jsx)(`ellipse`,{cx:Se,cy:Ce,rx:1.2722,ry:1.9083,className:J}),t[29]=J,t[30]=ce);let ue;t[31]===te?ue=t[32]:(ue=Te(xe,te),t[31]=te,t[32]=ue);let de=(!V||M)&&`ok-blob-eye-hidden`,we;t[33]===de?we=t[34]:(we=s(`ok-blob-happy-eye`,de),t[33]=de,t[34]=we);let De;t[35]!==ue||t[36]!==we?(De=(0,Y.jsx)(`path`,{d:ue,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:we}),t[35]=ue,t[36]=we,t[37]=De):De=t[37];let Oe;t[38]===te?Oe=t[39]:(Oe=Te(Se,te),t[38]=te,t[39]=Oe);let ke=(!V||M)&&`ok-blob-eye-hidden`,Ae;t[40]===ke?Ae=t[41]:(Ae=s(`ok-blob-happy-eye`,ke),t[40]=ke,t[41]=Ae);let Le;t[42]!==Oe||t[43]!==Ae?(Le=(0,Y.jsx)(`path`,{d:Oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:Ae}),t[42]=Oe,t[43]=Ae,t[44]=Le):Le=t[44];let Re;t[45]===M?Re=t[46]:(Re=M?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:Ee(xe),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Y.jsx)(`path`,{d:Ee(Se),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=M,t[46]=Re);let ze;t[47]!==oe||t[48]!==ce||t[49]!==De||t[50]!==Le||t[51]!==Re?(ze=(0,Y.jsxs)(`g`,{ref:_,children:[oe,ce,De,Le,Re]}),t[47]=oe,t[48]=ce,t[49]=De,t[50]=Le,t[51]=Re,t[52]=ze):ze=t[52];let Q;t[53]!==W||t[54]!==G||t[55]!==ze?(Q=(0,Y.jsxs)(`g`,{className:G,children:[K,ze]},W),t[53]=W,t[54]=G,t[55]=ze,t[56]=Q):Q=t[56];let Be;t[57]===M?Be=t[58]:(Be=M?(0,Y.jsxs)(`g`,{children:[(0,Y.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Y.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[57]=M,t[58]=Be);let Ve;t[59]!==w||t[60]!==D?(Ve=D.length>0&&(0,Y.jsx)(`g`,{"data-slot":`ok-blob-burst`,children:D.map(je)},`firework-${w}`),t[59]=w,t[60]=D,t[61]=Ve):Ve=t[61];let He;t[62]!==P||t[63]!==d||t[64]!==ne||t[65]!==Q||t[66]!==Be||t[67]!==Ve?(He=(0,Y.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:Me,children:[Q,Be,Ve]}),t[62]=P,t[63]=d,t[64]=ne,t[65]=Q,t[66]=Be,t[67]=Ve,t[68]=He):He=t[68];let Ue;return t[69]!==i||t[70]!==U||t[71]!==He?(Ue=(0,Y.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 je(e){return(0,Y.jsx)(`circle`,{cx:De+e.originDx,cy:Oe+e.originDy,r:e.size,className:`ok-blob-firework`,style:ke(e)},e.id)}function Me(e){return e.preventDefault()}function Ne(e){return e+1}function Pe(e){return e+1}function Fe(e){return e+1}function Ie(e){return e+1}var Le=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`}]]),Re=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`}]]),ze=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`}]]),Q=[...new Set(L.flatMap(e=>e.schemes))];function Be(e,t){let n=t.now?.()??Date.now(),r={};for(let t of L){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 Ve(e){return Be({},e)}async function He(e){let t=e.schemes??Q,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 Ue=Object.fromEntries(Q.map(e=>[e,{installed:!1}]));async function We(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 Ue}if(!t.ok)return Ue;let n;try{n=await t.json()}catch{return Ue}if(typeof n!=`object`||!n||Array.isArray(n))return Ue;let r=n,i={};for(let e of Q)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Ge(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 Ke(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Ve({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Be(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=!Ge(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 qe(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Je(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>He({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>We({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Ye(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(Xe),r=(0,X.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Ke(Je());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,X.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 Xe(){return Ve({isElectronHost:qe(),now:Date.now})}var Ze=(0,X.createContext)(null);function Qe(e){let t=(0,Z.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Y.jsx)(Ze,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function $e(){return(0,X.use)(Ze)}function et(e){let t=(0,Z.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,Y.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,Y.jsx)(_,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===u?M=t[23]:(M=u?(0,Y.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,Y.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,Y.jsx)(v,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsx)(i,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===r?I=t[32]:(I=(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ne,{"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,Y.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,Y.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,Y.jsxs)(p,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function tt(e){let t=(0,Z.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[{x:1.9,y:0,w:15.15},{x:8,y:4.22,w:15.15},{x:4.35,y:8.44,w:15.3},{x:0,y:12.66,w:15.15},{x:4.35,y:16.88,w:15.3},{x:14.1,y:21.1,w:9.9}],t[0]=n):n=t[0];let r=n,i,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(`title`,{children:`LM Studio icon`}),a=r.map(nt),t[1]=i,t[2]=a):(i=t[1],a=t[2]);let o;return t[3]===e?o=t[4]:(o=(0,Y.jsxs)(`svg`,{role:`img`,"aria-label":`LM Studio icon`,xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,fill:`currentColor`,viewBox:`0 0 24 24`,...e,children:[i,a]}),t[3]=e,t[4]=o),o}function nt(e){return(0,Y.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:2.9,rx:1.45},e.y)}function rt(e){return e===`agents`||e===`.agents`||e.startsWith(`.agents/`)?`.agents`:e.includes(`/`)?e:B[e]??e}function it(e){return e===`claude`?`claude-code`:e}function at(e){let t=(0,Z.c)(20),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,Y.jsx)(n,{...i}),t[3]=i,t[4]=e),e}if(r===`lm-studio`){let e;return t[5]===i?e=t[6]:(e=(0,Y.jsx)(tt,{...i}),t[5]=i,t[6]=e),e}if(r.includes(`/`)){if(r===`.agents`||r.startsWith(`.agents/`)){let e;return t[7]===i?e=t[8]:(e=(0,Y.jsx)(n,{...i}),t[7]=i,t[8]=e),e}if(r===`.ok`||r.startsWith(`.ok/`)){let e;if(t[9]!==i){let{className:n,...r}=i;e=r,t[9]=i,t[10]=e}else e=t[10];let n=e,r;return t[11]===n?r=t[12]:(r=(0,Y.jsx)(Ae,{size:14,...n}),t[11]=n,t[12]=r),r}let e;return t[13]===i?e=t[14]:(e=(0,Y.jsx)(U,{...i}),t[13]=i,t[14]=e),e}let a;t[15]===r?a=t[16]:(a=it(r),t[15]=r,t[16]=a);let o;return t[17]!==i||t[18]!==a?(o=(0,Y.jsx)(E,{...i,id:a}),t[17]=i,t[18]=a,t[19]=o):o=t[19],o}function ot(e){let t=(0,Z.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,Y.jsxs)(f,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,Y.jsx)(at,{host:e,className:s(`size-3.5 shrink-0`,i),"aria-label":rt(e)})})}),(0,Y.jsx)(d,{children:rt(e)})]},e),t[8]=i,t[9]=p),o=e.map(p),c=l.length>0?(0,Y.jsxs)(f,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsxs)(`span`,{className:`ml-0.5 cursor-default`,children:[`+`,l.length]})}),(0,Y.jsx)(d,{children:l.map(rt).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,Y.jsxs)(`span`,{className:a,children:[o,c]}),t[10]=a,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function st(e){let t=(0,Z.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,Y.jsx)(i,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,Y.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 ct(e){let t=(0,Z.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,Y.jsx)(D,{...r}):(0,Y.jsx)(M,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function lt(e){let t=(0,Z.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,Y.jsx)(x,{...r}):(0,Y.jsx)(k,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ut(e){let t=(0,Z.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,Y.jsx)(b,{...r}):(0,Y.jsx)(N,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function dt(e){let t=(0,Z.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,Y.jsx)(w,{...r}):(0,Y.jsx)(P,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ft(e){let t=(0,Z.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,Y.jsx)(O,{...r}):(0,Y.jsx)(I,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function pt(e){let t=(0,Z.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,Y.jsx)(S,{...r}):(0,Y.jsx)(A,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function mt(e){let t=(0,Z.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,Y.jsx)(C,{...r}):(0,Y.jsx)(j,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ht(e){let t=(0,Z.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,Y.jsx)(T,{...r}):(0,Y.jsx)(F,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var gt=Object.freeze({hosts:null,source:null}),_t=new Map,vt=new Map;function yt(e,t){return`${e}:${t}`}function bt(e){return _t.get(e)??gt}function xt(e,t){let n=vt.get(e)??new Set;return vt.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&vt.delete(e)}}function St(e,t){let n=bt(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?_t.delete(e):_t.set(e,r);for(let t of vt.get(e)??[])t()}}var Ct=R.options,wt=z.options,Tt=`.agents/`;function Et({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${ae(t,e.scope)}/${e.name}`:null,o=e?.hubOffered??(e&&t!==null?t.find(t=>t.scope===e.scope)?.hubOffered:void 0),s=e!==void 0&&(o===!0||(e.hosts??[]).includes(`agents`)||t?.some(t=>t.scope===e.scope&&(t.hosts.includes(`agents`)||t.path.startsWith(Tt)))),c=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),l=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),u=l?new Set(l):null,d=e?.scope===`global`?wt:Ct,f=(s?[...d,`agents`]:d).filter(e=>!(e in c)).filter(e=>e===`agents`||u===null||u.has(e)||n.has(e)),p=new Set(f.map(e=>a(e))),m=e?.scope===`global`?`~/`:``,h=e?.path?.includes(`/`)?`${m}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,g=h!==null&&!p.has(h)?h:null,_=g===null?r??e?.hosts?.[0]:void 0,v=new Set(e?.conflictHosts??[]),y=new Set(e?.driftPaths??[]),b=new Set(e?.symlinkedHosts??[]),x=[...[...n].filter(e=>e!==_&&!(e in c)&&!v.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:b.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:q(e),display:`${m}${e.path}`,mode:e.mode}))],S=x.map(e=>e.mode),C=S.filter(e=>e===`link`).length,w=S.length===0?i?`link`:`copy`:C*2>=S.length?`link`:`copy`,T=new Map((e?.customPlacements??[]).map(e=>[q(e),e])),E=new Set(T.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=q(e);t!==``&&E.add(t)}}return{pathFor:a,aliases:c,rows:f,sourceRow:g,sourceHost:_,conflicted:v,drifted:y,linked:b,expectedMode:w,convertible:x,customRootRows:e===void 0?[]:[...E].sort().map(t=>({root:t,display:`${m}${t}/${e.name}`,placed:T.get(t)??null})).filter(e=>!p.has(e.display)&&e.display!==h&&!(e.root in c))}}var Dt=`min-w-[24rem]`;function Ot(e,t){let n=(0,Z.c)(45),r=t.installingName===e.name,i=(0,X.useRef)(e),[a,o]=(0,X.useState)(!1),s=(0,X.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,X.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,X.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=yt(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=>xt(m,e),g=()=>bt(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,X.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&&St(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,X.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,X.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,X.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=bt(m).hosts;e&&[...e].sort().join(`,`)===j&&St(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,X.useEffect)(M,N);let P=(0,X.useRef)(null),F=(0,X.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,X.useEffect)(I,L);let R;n[31]!==t||n[32]!==m||n[33]!==e?(R=function(n,r){D.current=n,St(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(ee));if(!r.ok){St(m,{hosts:null});return}D.current=[...r.hosts],St(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]=R):R=n[34];let z=R,B;return n[35]!==t||n[36]!==z||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(B={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)},installAll(){let t=e.scope===`global`?wt:Ct,n=D.current.filter(e=>!t.includes(e)),r=e.installableEditors??t,i=t.filter(e=>r.includes(e)||D.current.includes(e));z([...n,...i],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>K({scope:e.scope,name:e.name,dir:n,mode:r})).then(At)},unplaceAt(n){t.runLocationWrite(e,()=>W({scope:e.scope,name:e.name,path:n})).then(kt)},setSource(n){St(m,{source:n}),t.runLocationWrite(e,()=>G({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(St(m,{source:null}),V.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=z,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=B):B=n[44],B}function kt(e){e.ok||V.error(e.error)}function At(e){e.ok||V.error(e.error)}function $(e){let t=(0,Z.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Y.jsx)(u,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Y.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,Y.jsxs)(f,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function jt(e){let t=(0,Z.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=J(),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}=Et({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=>oe(a,e),F=Rt,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:ae(e,r?.scope??`project`);return(0,Y.jsx)($,{hint:d({id:`0dslv8`,values:{0:F(e),1:F(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Y.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}}))&&re({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?te():V.error(d({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Y.jsx)(at,{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=ie(r),ee=Lt,H;t[24]!==d||t[25]!==s||t[26]!==n?(H=(e,t,r)=>{let a=r===`link`?`copy`:`link`;return(0,Y.jsx)($,{hint:d(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Y.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,Y.jsx)(i,{id:`uUCrBv`}):(0,Y.jsx)(i,{id:`iaPtht`})})})},t[24]=d,t[25]=s,t[26]=n,t[27]=H):H=t[27];let ne=H,W;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Y.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 q;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Y.jsx)(i,{id:`N40H-G`}),t[33]=q):q=t[33];let J;t[34]!==g||t[35]!==K?(J=(0,Y.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:q}),t[34]=g,t[35]=K,t[36]=J):J=t[36];let X;t[37]!==G||t[38]!==J?(X=(0,Y.jsx)($,{hint:G,children:J}),t[37]=G,t[38]=J,t[39]=X):X=t[39],t[40]!==u||t[41]!==X?(S=(0,Y.jsxs)(dt,{menuKind:u,className:`flex items-center justify-between gap-2`,children:[W,X]}),t[40]=u,t[41]=X,t[42]=S):S=t[42],C=x===null?null:(0,Y.jsx)($,{hint:d({id:`pXB6SL`}),children:(0,Y.jsxs)(ut,{menuKind:u,disabled:g,checked:!0,onSelect:It,"data-testid":`skill-source-row`,children:[(0,Y.jsx)(U,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:x}),(()=>{let e=ee(x).split(`/`).slice(0,-1).join(`/`),t=P(e);return t.length>0?(0,Y.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,Y.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,Y.jsx)(i,{id:`tiFPjk`})})]})]})}),w=b.map(t=>{let a=e(t),s=t===`agents`?`.agents`:B[t],c=ee(a).split(`/`).slice(0,-1).join(`/`),m=P(c);return(0,Y.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}}):z?.editor===t?d({id:`_3S4Ql`,values:{0:r?.name??``,1:z.plugin,2:a??s,label:s}}):d(a?D===void 0?{id:`xk133d`,values:{path:a}}:y===`link`?{id:`1LtA5r`,values:{path:a}}:{id:`opPbzN`,values:{path:a}}:{id:`Pp0Vgd`,values:{label:s}}),children:(0,Y.jsxs)(ut,{menuKind:u,disabled:g,checked:f.has(t),onCheckedChange:e=>{O.has(t)||e===!0&&!I(c)||p(t,e===!0)},onSelect:Ft,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,Y.jsx)(at,{host:t,"aria-hidden":!0,className:`size-4`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a??s}),m.length>0?(0,Y.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,z?.editor===t&&!f.has(t)?(0,Y.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`,"data-testid":`skill-row-plugin-covered-${t}`,children:(0,Y.jsx)(i,{id:`scRzTw`})}):null,O.has(t)?(0,Y.jsx)($,{hint:d({id:`_O7dJS`}),children:(0,Y.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,Y.jsx)(i,{id:`jng7Ko`})})}):t===D?(0,Y.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,Y.jsx)(i,{id:`tiFPjk`})}):f.has(t)&&r?.hosts?(0,Y.jsxs)(Y.Fragment,{children:[!g&&(A.has(t)?`link`:`copy`)!==y?ne(t,a??s,A.has(t)?`link`:`copy`):null,(0,Y.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,Y.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,Y.jsx)(i,{id:`VNNRfN`})})})]}):null,!g&&k.has(ee(a))?(0,Y.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,Y.jsx)(st,{testId:`skill-drift-${t}`})}):null]})]})},t)}),T=v.map(e=>{let t=e.display;return(0,Y.jsx)($,{hint:e.placed===null?d(D===void 0?{id:`xk133d`,values:{path:t}}:y===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}):d({id:`9ieZhu`,values:{path:t}}),children:(0,Y.jsxs)(ut,{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:Pt,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Y.jsx)(at,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Y.jsx)(U,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),P(e.root).length>0?(0,Y.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,Y.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,Y.jsx)(st,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Y.jsxs)(Y.Fragment,{children:[!g&&e.placed.mode!==y?ne(e.root,e.display,e.placed.mode):null,(0,Y.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,Y.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,Y.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,Y.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Y.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(Nt).join(`
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{er as n}from"./DocumentContext-CZ1LyjXH.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{r as c}from"./clipboard-adapter-815RzzoI.js";import{t as l}from"./button-Cym3gapE.js";import{i as u,n as d,t as f}from"./tooltip-DttaCTqz.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-D9BtoYXB.js";import{a as b,c as x,d as S,f as C,l as w,p as T,r as E,s as D,u as O}from"./terminal-cli-display-C2L3vHWw.js";import{a as k,d as A,f as j,i as M,n as N,o as P,p as F,u as I}from"./dropdown-menu-CRvS0_4-.js";import{f as L}from"./RegisteredAgentIcon-CDl1h-4U.js";import{Jt as R,Xt as z,po as B,ri as ee}from"./dist-As2x8uCt.js";import{n as V}from"./dist-CJhtNlOm2.js";import{c as te}from"./documents-events-2g_OBjKU.js";import{t as H}from"./createLucideIcon-BulbvLvN.js";import{c as U}from"./use-open-skill-DzG96lKz.js";import{t as ne}from"./spinner-t7GahFcQ.js";import{N as W,S as re,j as G,x as K}from"./skills-api-KE9J-94z.js";import{i as ie,l as ae,n as oe,r as q}from"./skill-scope-CauFSzAn.js";import{t as J}from"./use-skills-RpG-BeVz.js";var Y=t(),X=e(r(),1),Z=o(),se=3100,ce=3;function le(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??ce;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var ue={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}},de=[`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 fe(e,t={}){let n=t.rng??Math.random,r=t.colors??de,i=ue[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 pe=1.8,me=90,he=16,ge=380,_e=.025,ve=.1,ye=.18,be=400,xe=9.2736,Se=18.1799,Ce=14.5244,we={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Te(e,t){let{halfWidth:n,apexLift:r}=we[t];return`M${e-n} ${Ce+.3} Q${e} ${Ce-r}, ${e+n} ${Ce+.3}`}function Ee(e){let t=1.5,n=.3;return`M${e-t} ${Ce-n} Q${e} ${Ce+1.4}, ${e+t} ${Ce-n}`}var De=15,Oe=15;function ke(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 Ae(e){let t=(0,Z.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,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.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,X.useRef)(v),[b,x]=(0,X.useState)(0),[S,C]=(0,X.useState)(0),[w,T]=(0,X.useState)(0),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[1]=E):E=t[1];let[D,O]=(0,X.useState)(E),k=(0,X.useRef)(0),A=(0,X.useRef)(0),j=(0,X.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=le(b,t),r=b===3&&e-k.current<3100,i=n===3&&r;n===3&&u?.(),x(n),C(Ie),i||(O(fe(n)),n===3&&(k.current=e,T(Fe))),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},se)},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,X.useEffect)(F,I);let L,R;t[8]!==m||t[9]!==M?(L=()=>{m===0||M||(x(3),C(Pe),O(fe(3)),k.current=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),T(Ne),clearTimeout(j.current),j.current=setTimeout(()=>{x(0),O([])},se))},R=[m,M],t[8]=m,t[9]=M,t[10]=L,t[11]=R):(L=t[10],R=t[11]),(0,X.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/ge)),C=-Math.max(-1,Math.min(1,b/ge))*he,w=S*he,T=0,E=0;if(x>=1){let e=Math.min(x/me,1)*pe;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)*ve,i+=(w-i)*ve,u.style.transform=`perspective(${be}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*ye,o+=(E-o)*ye;let O=i*_e,k=-r*_e,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,X.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,X.useLayoutEffect)(ee);let V=b>0,te=V?b:1,H=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`,W=`body-${S}`,re=M&&`ok-blob-sleeping`,G;t[19]!==H||t[20]!==re?(G=s(`ok-blob-group`,re,H),t[19]=H,t[20]=re,t[21]=G):G=t[21];let K;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Y.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 oe;t[25]===ae?oe=t[26]:(oe=(0,Y.jsx)(`ellipse`,{cx:xe,cy:Ce,rx:1.2722,ry:1.9083,className:ae}),t[25]=ae,t[26]=oe);let q=(V||M)&&`ok-blob-eye-hidden`,J;t[27]===q?J=t[28]:(J=s(`ok-blob-eye ok-blob-eye-right`,q),t[27]=q,t[28]=J);let ce;t[29]===J?ce=t[30]:(ce=(0,Y.jsx)(`ellipse`,{cx:Se,cy:Ce,rx:1.2722,ry:1.9083,className:J}),t[29]=J,t[30]=ce);let ue;t[31]===te?ue=t[32]:(ue=Te(xe,te),t[31]=te,t[32]=ue);let de=(!V||M)&&`ok-blob-eye-hidden`,we;t[33]===de?we=t[34]:(we=s(`ok-blob-happy-eye`,de),t[33]=de,t[34]=we);let De;t[35]!==ue||t[36]!==we?(De=(0,Y.jsx)(`path`,{d:ue,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:we}),t[35]=ue,t[36]=we,t[37]=De):De=t[37];let Oe;t[38]===te?Oe=t[39]:(Oe=Te(Se,te),t[38]=te,t[39]=Oe);let ke=(!V||M)&&`ok-blob-eye-hidden`,Ae;t[40]===ke?Ae=t[41]:(Ae=s(`ok-blob-happy-eye`,ke),t[40]=ke,t[41]=Ae);let Le;t[42]!==Oe||t[43]!==Ae?(Le=(0,Y.jsx)(`path`,{d:Oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:Ae}),t[42]=Oe,t[43]=Ae,t[44]=Le):Le=t[44];let Re;t[45]===M?Re=t[46]:(Re=M?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:Ee(xe),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Y.jsx)(`path`,{d:Ee(Se),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=M,t[46]=Re);let ze;t[47]!==oe||t[48]!==ce||t[49]!==De||t[50]!==Le||t[51]!==Re?(ze=(0,Y.jsxs)(`g`,{ref:_,children:[oe,ce,De,Le,Re]}),t[47]=oe,t[48]=ce,t[49]=De,t[50]=Le,t[51]=Re,t[52]=ze):ze=t[52];let Q;t[53]!==W||t[54]!==G||t[55]!==ze?(Q=(0,Y.jsxs)(`g`,{className:G,children:[K,ze]},W),t[53]=W,t[54]=G,t[55]=ze,t[56]=Q):Q=t[56];let Be;t[57]===M?Be=t[58]:(Be=M?(0,Y.jsxs)(`g`,{children:[(0,Y.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Y.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[57]=M,t[58]=Be);let Ve;t[59]!==w||t[60]!==D?(Ve=D.length>0&&(0,Y.jsx)(`g`,{"data-slot":`ok-blob-burst`,children:D.map(je)},`firework-${w}`),t[59]=w,t[60]=D,t[61]=Ve):Ve=t[61];let He;t[62]!==P||t[63]!==d||t[64]!==ne||t[65]!==Q||t[66]!==Be||t[67]!==Ve?(He=(0,Y.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:Me,children:[Q,Be,Ve]}),t[62]=P,t[63]=d,t[64]=ne,t[65]=Q,t[66]=Be,t[67]=Ve,t[68]=He):He=t[68];let Ue;return t[69]!==i||t[70]!==U||t[71]!==He?(Ue=(0,Y.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 je(e){return(0,Y.jsx)(`circle`,{cx:De+e.originDx,cy:Oe+e.originDy,r:e.size,className:`ok-blob-firework`,style:ke(e)},e.id)}function Me(e){return e.preventDefault()}function Ne(e){return e+1}function Pe(e){return e+1}function Fe(e){return e+1}function Ie(e){return e+1}var Le=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`}]]),Re=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`}]]),ze=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`}]]),Q=[...new Set(L.flatMap(e=>e.schemes))];function Be(e,t){let n=t.now?.()??Date.now(),r={};for(let t of L){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 Ve(e){return Be({},e)}async function He(e){let t=e.schemes??Q,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 Ue=Object.fromEntries(Q.map(e=>[e,{installed:!1}]));async function We(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 Ue}if(!t.ok)return Ue;let n;try{n=await t.json()}catch{return Ue}if(typeof n!=`object`||!n||Array.isArray(n))return Ue;let r=n,i={};for(let e of Q)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Ge(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 Ke(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Ve({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Be(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=!Ge(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 qe(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Je(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>He({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>We({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Ye(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(Xe),r=(0,X.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Ke(Je());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,X.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 Xe(){return Ve({isElectronHost:qe(),now:Date.now})}var Ze=(0,X.createContext)(null);function Qe(e){let t=(0,Z.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Y.jsx)(Ze,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function $e(){return(0,X.use)(Ze)}function et(e){let t=(0,Z.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,Y.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,Y.jsx)(_,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===u?M=t[23]:(M=u?(0,Y.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,Y.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,Y.jsx)(v,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsx)(i,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===r?I=t[32]:(I=(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ne,{"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,Y.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,Y.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,Y.jsxs)(p,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function tt(e){let t=(0,Z.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[{x:1.9,y:0,w:15.15},{x:8,y:4.22,w:15.15},{x:4.35,y:8.44,w:15.3},{x:0,y:12.66,w:15.15},{x:4.35,y:16.88,w:15.3},{x:14.1,y:21.1,w:9.9}],t[0]=n):n=t[0];let r=n,i,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(`title`,{children:`LM Studio icon`}),a=r.map(nt),t[1]=i,t[2]=a):(i=t[1],a=t[2]);let o;return t[3]===e?o=t[4]:(o=(0,Y.jsxs)(`svg`,{role:`img`,"aria-label":`LM Studio icon`,xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,fill:`currentColor`,viewBox:`0 0 24 24`,...e,children:[i,a]}),t[3]=e,t[4]=o),o}function nt(e){return(0,Y.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:2.9,rx:1.45},e.y)}function rt(e){return e===`agents`||e===`.agents`||e.startsWith(`.agents/`)?`.agents`:e.includes(`/`)?e:B[e]??e}function it(e){return e===`claude`?`claude-code`:e}function at(e){let t=(0,Z.c)(20),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,Y.jsx)(n,{...i}),t[3]=i,t[4]=e),e}if(r===`lm-studio`){let e;return t[5]===i?e=t[6]:(e=(0,Y.jsx)(tt,{...i}),t[5]=i,t[6]=e),e}if(r.includes(`/`)){if(r===`.agents`||r.startsWith(`.agents/`)){let e;return t[7]===i?e=t[8]:(e=(0,Y.jsx)(n,{...i}),t[7]=i,t[8]=e),e}if(r===`.ok`||r.startsWith(`.ok/`)){let e;if(t[9]!==i){let{className:n,...r}=i;e=r,t[9]=i,t[10]=e}else e=t[10];let n=e,r;return t[11]===n?r=t[12]:(r=(0,Y.jsx)(Ae,{size:14,...n}),t[11]=n,t[12]=r),r}let e;return t[13]===i?e=t[14]:(e=(0,Y.jsx)(U,{...i}),t[13]=i,t[14]=e),e}let a;t[15]===r?a=t[16]:(a=it(r),t[15]=r,t[16]=a);let o;return t[17]!==i||t[18]!==a?(o=(0,Y.jsx)(E,{...i,id:a}),t[17]=i,t[18]=a,t[19]=o):o=t[19],o}function ot(e){let t=(0,Z.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,Y.jsxs)(f,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,Y.jsx)(at,{host:e,className:s(`size-3.5 shrink-0`,i),"aria-label":rt(e)})})}),(0,Y.jsx)(d,{children:rt(e)})]},e),t[8]=i,t[9]=p),o=e.map(p),c=l.length>0?(0,Y.jsxs)(f,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsxs)(`span`,{className:`ml-0.5 cursor-default`,children:[`+`,l.length]})}),(0,Y.jsx)(d,{children:l.map(rt).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,Y.jsxs)(`span`,{className:a,children:[o,c]}),t[10]=a,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function st(e){let t=(0,Z.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,Y.jsx)(i,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,Y.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 ct(e){let t=(0,Z.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,Y.jsx)(D,{...r}):(0,Y.jsx)(M,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function lt(e){let t=(0,Z.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,Y.jsx)(x,{...r}):(0,Y.jsx)(k,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ut(e){let t=(0,Z.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,Y.jsx)(b,{...r}):(0,Y.jsx)(N,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function dt(e){let t=(0,Z.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,Y.jsx)(w,{...r}):(0,Y.jsx)(P,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ft(e){let t=(0,Z.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,Y.jsx)(O,{...r}):(0,Y.jsx)(I,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function pt(e){let t=(0,Z.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,Y.jsx)(S,{...r}):(0,Y.jsx)(A,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function mt(e){let t=(0,Z.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,Y.jsx)(C,{...r}):(0,Y.jsx)(j,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ht(e){let t=(0,Z.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,Y.jsx)(T,{...r}):(0,Y.jsx)(F,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var gt=Object.freeze({hosts:null,source:null}),_t=new Map,vt=new Map;function yt(e,t){return`${e}:${t}`}function bt(e){return _t.get(e)??gt}function xt(e,t){let n=vt.get(e)??new Set;return vt.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&vt.delete(e)}}function St(e,t){let n=bt(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?_t.delete(e):_t.set(e,r);for(let t of vt.get(e)??[])t()}}var Ct=R.options,wt=z.options,Tt=`.agents/`;function Et({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${ae(t,e.scope)}/${e.name}`:null,o=e?.hubOffered??(e&&t!==null?t.find(t=>t.scope===e.scope)?.hubOffered:void 0),s=e!==void 0&&(o===!0||(e.hosts??[]).includes(`agents`)||t?.some(t=>t.scope===e.scope&&(t.hosts.includes(`agents`)||t.path.startsWith(Tt)))),c=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),l=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),u=l?new Set(l):null,d=e?.scope===`global`?wt:Ct,f=(s?[...d,`agents`]:d).filter(e=>!(e in c)).filter(e=>e===`agents`||u===null||u.has(e)||n.has(e)),p=new Set(f.map(e=>a(e))),m=e?.scope===`global`?`~/`:``,h=e?.path?.includes(`/`)?`${m}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,g=h!==null&&!p.has(h)?h:null,_=g===null?r??e?.hosts?.[0]:void 0,v=new Set(e?.conflictHosts??[]),y=new Set(e?.driftPaths??[]),b=new Set(e?.symlinkedHosts??[]),x=[...[...n].filter(e=>e!==_&&!(e in c)&&!v.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:b.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:q(e),display:`${m}${e.path}`,mode:e.mode}))],S=x.map(e=>e.mode),C=S.filter(e=>e===`link`).length,w=S.length===0?i?`link`:`copy`:C*2>=S.length?`link`:`copy`,T=new Map((e?.customPlacements??[]).map(e=>[q(e),e])),E=new Set(T.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=q(e);t!==``&&E.add(t)}}return{pathFor:a,aliases:c,rows:f,sourceRow:g,sourceHost:_,conflicted:v,drifted:y,linked:b,expectedMode:w,convertible:x,customRootRows:e===void 0?[]:[...E].sort().map(t=>({root:t,display:`${m}${t}/${e.name}`,placed:T.get(t)??null})).filter(e=>!p.has(e.display)&&e.display!==h&&!(e.root in c))}}var Dt=`min-w-[24rem]`;function Ot(e,t){let n=(0,Z.c)(45),r=t.installingName===e.name,i=(0,X.useRef)(e),[a,o]=(0,X.useState)(!1),s=(0,X.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,X.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,X.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=yt(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=>xt(m,e),g=()=>bt(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,X.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&&St(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,X.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,X.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,X.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=bt(m).hosts;e&&[...e].sort().join(`,`)===j&&St(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,X.useEffect)(M,N);let P=(0,X.useRef)(null),F=(0,X.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,X.useEffect)(I,L);let R;n[31]!==t||n[32]!==m||n[33]!==e?(R=function(n,r){D.current=n,St(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(ee));if(!r.ok){St(m,{hosts:null});return}D.current=[...r.hosts],St(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]=R):R=n[34];let z=R,B;return n[35]!==t||n[36]!==z||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(B={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)},installAll(){let t=e.scope===`global`?wt:Ct,n=D.current.filter(e=>!t.includes(e)),r=e.installableEditors??t,i=t.filter(e=>r.includes(e)||D.current.includes(e));z([...n,...i],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>K({scope:e.scope,name:e.name,dir:n,mode:r})).then(At)},unplaceAt(n){t.runLocationWrite(e,()=>W({scope:e.scope,name:e.name,path:n})).then(kt)},setSource(n){St(m,{source:n}),t.runLocationWrite(e,()=>G({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(St(m,{source:null}),V.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=z,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=B):B=n[44],B}function kt(e){e.ok||V.error(e.error)}function At(e){e.ok||V.error(e.error)}function $(e){let t=(0,Z.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Y.jsx)(u,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Y.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,Y.jsxs)(f,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function jt(e){let t=(0,Z.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=J(),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}=Et({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=>oe(a,e),F=Rt,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:ae(e,r?.scope??`project`);return(0,Y.jsx)($,{hint:d({id:`0dslv8`,values:{0:F(e),1:F(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Y.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}}))&&re({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?te():V.error(d({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Y.jsx)(at,{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=ie(r),ee=Lt,H;t[24]!==d||t[25]!==s||t[26]!==n?(H=(e,t,r)=>{let a=r===`link`?`copy`:`link`;return(0,Y.jsx)($,{hint:d(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Y.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,Y.jsx)(i,{id:`uUCrBv`}):(0,Y.jsx)(i,{id:`iaPtht`})})})},t[24]=d,t[25]=s,t[26]=n,t[27]=H):H=t[27];let ne=H,W;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Y.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 q;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Y.jsx)(i,{id:`N40H-G`}),t[33]=q):q=t[33];let J;t[34]!==g||t[35]!==K?(J=(0,Y.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:q}),t[34]=g,t[35]=K,t[36]=J):J=t[36];let X;t[37]!==G||t[38]!==J?(X=(0,Y.jsx)($,{hint:G,children:J}),t[37]=G,t[38]=J,t[39]=X):X=t[39],t[40]!==u||t[41]!==X?(S=(0,Y.jsxs)(dt,{menuKind:u,className:`flex items-center justify-between gap-2`,children:[W,X]}),t[40]=u,t[41]=X,t[42]=S):S=t[42],C=x===null?null:(0,Y.jsx)($,{hint:d({id:`pXB6SL`}),children:(0,Y.jsxs)(ut,{menuKind:u,disabled:g,checked:!0,onSelect:It,"data-testid":`skill-source-row`,children:[(0,Y.jsx)(U,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:x}),(()=>{let e=ee(x).split(`/`).slice(0,-1).join(`/`),t=P(e);return t.length>0?(0,Y.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,Y.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,Y.jsx)(i,{id:`tiFPjk`})})]})]})}),w=b.map(t=>{let a=e(t),s=t===`agents`?`.agents`:B[t],c=ee(a).split(`/`).slice(0,-1).join(`/`),m=P(c);return(0,Y.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}}):z?.editor===t?d({id:`_3S4Ql`,values:{0:r?.name??``,1:z.plugin,2:a??s,label:s}}):d(a?D===void 0?{id:`xk133d`,values:{path:a}}:y===`link`?{id:`1LtA5r`,values:{path:a}}:{id:`opPbzN`,values:{path:a}}:{id:`Pp0Vgd`,values:{label:s}}),children:(0,Y.jsxs)(ut,{menuKind:u,disabled:g,checked:f.has(t),onCheckedChange:e=>{O.has(t)||e===!0&&!I(c)||p(t,e===!0)},onSelect:Ft,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,Y.jsx)(at,{host:t,"aria-hidden":!0,className:`size-4`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a??s}),m.length>0?(0,Y.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,z?.editor===t&&!f.has(t)?(0,Y.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`,"data-testid":`skill-row-plugin-covered-${t}`,children:(0,Y.jsx)(i,{id:`scRzTw`})}):null,O.has(t)?(0,Y.jsx)($,{hint:d({id:`_O7dJS`}),children:(0,Y.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,Y.jsx)(i,{id:`jng7Ko`})})}):t===D?(0,Y.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,Y.jsx)(i,{id:`tiFPjk`})}):f.has(t)&&r?.hosts?(0,Y.jsxs)(Y.Fragment,{children:[!g&&(A.has(t)?`link`:`copy`)!==y?ne(t,a??s,A.has(t)?`link`:`copy`):null,(0,Y.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,Y.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,Y.jsx)(i,{id:`VNNRfN`})})})]}):null,!g&&k.has(ee(a))?(0,Y.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,Y.jsx)(st,{testId:`skill-drift-${t}`})}):null]})]})},t)}),T=v.map(e=>{let t=e.display;return(0,Y.jsx)($,{hint:e.placed===null?d(D===void 0?{id:`xk133d`,values:{path:t}}:y===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}):d({id:`9ieZhu`,values:{path:t}}),children:(0,Y.jsxs)(ut,{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:Pt,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Y.jsx)(at,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Y.jsx)(U,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),P(e.root).length>0?(0,Y.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,Y.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,Y.jsx)(st,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Y.jsxs)(Y.Fragment,{children:[!g&&e.placed.mode!==y?ne(e.root,e.display,e.placed.mode):null,(0,Y.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,Y.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,Y.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,Y.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Y.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(Nt).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,Y.jsx)(i,{id:`rcJmK8`}):(0,Y.jsx)(i,{id:`LBv_TR`})}),(0,Y.jsx)($,{hint:d({id:`0J6nhG`}),children:(0,Y.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:Mt,"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,Y.jsx)(ft,{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,Y.jsx)(ze,{"aria-hidden":!0}),M=(0,Y.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,Y.jsxs)(lt,{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,Y.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,Y.jsxs)(Y.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 Mt(e){return e.preventDefault()}function Nt(e){return e.display}function Pt(e){return e.preventDefault()}function Ft(e){return e.preventDefault()}function It(e){return e.preventDefault()}function Lt(e){return(e??``).replace(/^~\//,``)}function Rt(e){return e===`agents`?`.agents`:B[e]??e}export{Le as C,Re as S,et as _,Ct as a,Ye as b,dt as c,mt as d,ht as f,rt as g,ot as h,wt as i,ft as l,at as m,jt as n,ct as o,st as p,Ot as r,lt as s,Dt as t,pt as u,Qe as v,Ae as w,ze as x,$e 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-Cym3gapE.js";import{i as s,n as c,t as l}from"./tooltip-DttaCTqz.js";import{a as u,c as d,i as f,n as p,o as m,s as h,t as g}from"./dialog-CTNat3T_.js";import{t as _}from"./switch-iwBsEWej.js";import{t as v}from"./arrow-up-right-BTi7mHwL.js";import{t as y}from"./spinner-t7GahFcQ.js";import{t as b}from"./refresh-cw-BFSYd-XR.js";import{t as x}from"./undo-2-XcI_wHcs.js";import{t as S}from"./DiffView-DS16M3wC.js";import{t as C}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-Cym3gapE.js";import{i as s,n as c,t as l}from"./tooltip-DttaCTqz.js";import{a as u,c as d,i as f,n as p,o as m,s as h,t as g}from"./dialog-CTNat3T_.js";import{t as _}from"./switch-iwBsEWej.js";import{t as v}from"./arrow-up-right-BTi7mHwL.js";import{t as y}from"./spinner-t7GahFcQ.js";import{t as b}from"./refresh-cw-BFSYd-XR.js";import{t as x}from"./undo-2-XcI_wHcs.js";import{t as S}from"./DiffView-DS16M3wC.js";import{t as C}from"./use-skill-origin-uUY8unvE.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:_}=e,v;t[0]===a?v=t[1]:(v=(0,E.jsx)(d,{children:(0,E.jsx)(r,{id:`EPKVES`,values:{skillName:a}})}),t[0]=a,t[1]=v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,E.jsx)(u,{children:(0,E.jsx)(r,{id:`kKw0H3`})}),t[2]=y):y=t[2];let b;t[3]===v?b=t[4]:(b=(0,E.jsxs)(h,{children:[v,y]}),t[3]=v,t[4]=b);let x;t[5]!==s||t[6]!==c?(x=(0,E.jsx)(p,{className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsx)(S,{oldContent:s,newContent:c,layout:`unified`})}),t[5]=s,t[6]=c,t[7]=x):x=t[7];let C;t[8]===i?C=t[9]:(C=()=>i(!1),t[8]=i,t[9]=C);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]!==C?(D=(0,E.jsx)(o,{variant:`outline`,onClick:C,disabled:l,children:w}),t[11]=l,t[12]=C,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]!==_||t[18]!==O?(k=(0,E.jsx)(o,{onClick:_,disabled:l,children:O}),t[16]=l,t[17]=_,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==D||t[21]!==k?(A=(0,E.jsxs)(m,{children:[D,k]}),t[20]=D,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==A||t[24]!==b||t[25]!==x?(j=(0,E.jsxs)(f,{className:`flex max-h-[85vh] max-w-3xl flex-col`,children:[b,x,A]}),t[23]=A,t[24]=b,t[25]=x,t[26]=j):j=t[26];let M;return t[27]!==i||t[28]!==n||t[29]!==j?(M=(0,E.jsx)(g,{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,{_:u}=i(),d;t[0]!==a||t[1]!==n?(d={scope:n,name:a},t[0]=a,t[1]=n,t[2]=d):d=t[2];let{origin:f,github:p,displaySource:m,importedTitle:h,canReimport:g,updateAvailable:S,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=C(d),[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(!f)return null;let W;t[9]!==m||t[10]!==p||t[11]!==h?(W=p?(0,E.jsxs)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,title:h??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:m}),(0,E.jsx)(v,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,E.jsx)(`span`,{title:h??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:m}),t[9]=m,t[10]=p,t[11]=h,t[12]=W):W=t[12];let G;t[13]!==u||t[14]!==k||t[15]!==g||t[16]!==A||t[17]!==j?(G=g?(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)(_,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":u({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]=u,t[14]=k,t[15]=g,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]!==u||t[22]!==g||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&g&&M?(0,E.jsxs)(l,{children:[(0,E.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":u({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)(y,{icon:x,className:`size-3`,"aria-hidden":!0}):(0,E.jsx)(x,{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]=u,t[22]=g,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]!==u||t[30]!==g||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==S?(J=g&&S?(0,E.jsxs)(l,{children:[(0,E.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":u({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)(y,{icon:b,className:`size-3`,"aria-hidden":!0}):(0,E.jsx)(b,{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]=u,t[30]=g,t[31]=V,t[32]=P,t[33]=L,t[34]=S,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-BCXxl3_M.js → SkillToolbarControls-Bap6lIv8.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}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}from"./SkillInstallMenu-BwbbztKY.js";import{t as c}from"./button-Cym3gapE.js";import{a as l,m as u,r as d,t as f,u as p}from"./dropdown-menu-CRvS0_4-.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./select-XEGYznMI.js";import{l as x,n as S,r as C,t as w}from"./AddPropertiesButton-eMa8eBGf.js";import{t as T}from"./list-plus-nPRgk4Qi.js";import{p as E,t as D}from"./skill-scope-CauFSzAn.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=E(),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 x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(y,{}),t[6]=x):x=t[6];let S;t[7]!==f||t[8]!==p?(S=(0,k.jsx)(_,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:x}),t[7]=f,t[8]=p,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(m,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===u?w=t[12]:(w=D.map(e=>(0,k.jsx)(h,{value:e,children:u[e]},e)),t[11]=u,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(g,{align:`end`,children:(0,k.jsxs)(v,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==s||t[16]!==d||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(b,{value:n,onValueChange:d,disabled:s,children:[S,T]}),t[15]=s,t[16]=d,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.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,k.jsx)(x,{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 N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:m,problemCount:h,problemMessages:g}=e,{_}=i(),v;t[0]!==a||t[1]!==n?(v={scope:n,name:a},t[0]=a,t[1]=n,t[2]=v):v=t[2];let y=M(v),b;t[3]!==y.requestMove||t[4]!==n?(b=(0,k.jsx)(A,{value:n,onRequestMove:y.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=y.requestMove,t[4]=n,t[5]=b):b=t[5];let x;t[6]!==a||t[7]!==n?(x=(0,k.jsx)(C,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=x):x=t[8];let E;t[9]!==b||t[10]!==x?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b,x]}),t[9]=b,t[10]=x,t[11]=E):E=t[11];let D;t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==o?(D=o?(0,k.jsx)(w,{onAddProperty:m,problemCount:h,problemMessages:g,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=m,t[13]=h,t[14]=g,t[15]=o,t[16]=D):D=t[16];let j;t[17]===_?j=t[18]:(j=_({id:`Yzs3QX`}),t[17]=_,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(u,{asChild:!0,children:(0,k.jsx)(c,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===y?F=t[23]:(F=e=>y.requestMove(e),t[22]=y,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(S,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==m||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(p,{}),(0,k.jsxs)(l,{onSelect:m,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=m,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(d,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(f,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==y.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,y.dialog]}),t[36]=y.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N as SkillToolbarControls};
|
package/dist/public/assets/{SlidesToolbarControls-CJxgVynH.js → SlidesToolbarControls-BNqlGZ8e.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-Cym3gapE.js";import{i as s,n as c,t as l}from"./tooltip-DttaCTqz.js";import{yn 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-Cym3gapE.js";import{i as s,n as c,t as l}from"./tooltip-DttaCTqz.js";import{yn as u}from"./dist-As2x8uCt.js";import{t as d}from"./trace-api-BP9dN1Hz.js";import{n as f}from"./dist-CJhtNlOm2.js";import{n as p,t as m}from"./workspace-paths-CAsMig07.js";import{n as h}from"./use-workspace-DRylP9vX.js";import{t as g}from"./createLucideIcon-BulbvLvN.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{Dn as n,It as r,Mn as i,Rt as a,U as o,bt as s,gn as c,lt as l,mt as u,nn as ee,st as d,tn as te,ut as f,vn as ne,yt as p}from"./DocumentContext-Ak51fAXi.js";import{t as m}from"./react-f2sANaYj.js";import{n as h}from"./dist-PQ5KMVDh.js";import{t as re}from"./compiler-runtime-BfE3aGVn.js";import{J as g,M as _,X as ie,a as ae,b as v,i as oe,o as se}from"./CodeMirrorPropInput-Dp0ghtC3.js";import{Po as y,T as ce,Zi as le,oi as b,vo as x,wo as S}from"./dist-D1GzYuCD.js";import{i as ue}from"./use-apply-config-theme-CBmHKD_B.js";import{B as de,D as C,F as fe,L as pe,P as me,T as w,d as he,h as ge,i as _e,j as ve,m as T,r as ye,t as be,u as E}from"./typing-burst-detector-B0lg7vla.js";import{s as D}from"./startup-marks-Bvho0uc6.js";import"./config-provider-D-Y4Wg0x.js";import{$ as O,D as k,Dt as A,F as j,It as M,Lt as N,Ot as P,Pt as F,Y as I,Z as L,b as R,ct as z,ft as B,g as V,gt as H,ht as xe,it as U,kt as Se,l as W,lt as G,nt as K,pt as q,rt as J,ut as Y,v as X}from"./dist-nQee1FU7.js";import{a as Ce,n as we}from"./cm-theme-MqTIJzgL.js";import{i as Te,n as Ee,o as De,r as Oe}from"./dist-CWdEDKHh.js";import{o as ke,r as Ae}from"./selection-context-C95IJZrT.js";import{l as je}from"./lint-config-client-DeGP10La.js";import{a as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dist-D9xNKL3I2.js";import{n as ze,t as Be}from"./src-qGi8ucyG.js";var Z=e(m(),1),Ve=re();function He(){let e=p();return e===null?null:new Set(e.keys())}function Ue(e,t,n){let r=[],i=j(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);S.lastIndex=0;for(let e=S.exec(t);e!==null;e=S.exec(t)){let t=e[2];if(!y(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.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,s=i.slice(a,i.length-o),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&y(c)&&n!=null)return r.push(I.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=d.exec(s);if(l)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function We(e){let t=f(e);return t===null?[]:[O.fromClass(class{decorations;constructor(e){this.decorations=Ue(e.state,e.visibleRanges,He())}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=Ue(e.view.state,e.view.visibleRanges,He()))}},{decorations:e=>e.decorations}),L.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),i=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(i!==void 0){n.preventDefault();let e=p()?.get(i);return e===void 0?u():window.location.hash=s(i,e),!0}let a=n.target?.closest?.(`.cm-skill-path-link`),o=a instanceof HTMLElement?a.dataset.skillPath:void 0;return o===void 0?!1:(n.preventDefault(),window.location.hash=l(t,e,o),!0)}})]}var Ge=I.line({attributes:{dir:`auto`}});function Ke(e){let t=new F;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,Ge),r=n.to+1}return t.finish()}var qe=O.fromClass(class{decorations;constructor(e){this.decorations=Ke(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Ke(e.view))}},{decorations:e=>e.decorations}),Je=[L.perLineTextDirection.of(!0),qe],Ye=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Xe=`cm-lint-local-target`;function Ze(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 Qe(e,t){let n=V(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Ye.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function $e(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function et(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=Qe(e,Ze(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:$e(i.severity),message:C(i),source:`${i.source}/${i.code}`,markClass:Xe})}return r}var tt=M.define();function nt(e){let t={findings:[]};return[Ne(e=>g()?et(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(tt)))}),O.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:tt.of(null)}),Re(n)},i=w(e,e=>{e.status===`loaded`&&r(e.findings)}),a=ie(()=>r(t.findings));return{destroy(){i(),a()}}})]}function rt(e,t){return e.enabled?[Pe(),Ne(async n=>it(n.state.doc,await b(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 it(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=at(r);o&&(a.actions=[o]),n.push(a)}return n}function at(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 ot=[q(),G(),Y(),X(),J(),U(),Se.allowMultipleSelections.of(!0),k(),W(),Oe(),Ee(),H(),K(),z(),Me(),B.of([...Te,...we,...Le,...R,...De,...Ie])],st=I.mark({class:`cm-link-ref-broken`}),ct=/^\s{0,3}\[([^\]]+)\]:\s/,lt=/\[([^\]]*)\]\[([^\]]*)\]/g,ut=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 dt(e){let t=[];return j(e).iterate({enter(e){if(ut.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function ft(e){let t=new Set,n=[],r=e.doc,i=dt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if($(n.from,i))continue;let a=ct.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)&&!ct.test(t.text))for(lt.lastIndex=0;;){let e=lt.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(st.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var pt=N.define({create(e){return ft(e)},update(e,t){return t.docChanged?ft(t.state):e},provide:e=>L.decorations.from(e)}),mt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,ht=I.mark({class:`cm-del`}),gt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),_t=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function vt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function yt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!x.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(x.test(r.text))return{from:t.from,to:r.to}}return null}function bt(e,t){let n=[],r=j(e),i=yt(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(ht.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=mt.exec(r.text),a=i?i[1].length:2,o=I.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=vt(r.text),a=I.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(gt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(_t.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(_t.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var xt=class{decorations;constructor(e){this.decorations=bt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=bt(e.view.state,e.view.visibleRanges))}},St=O.fromClass(xt,{decorations:e=>e.decorations});function Ct(){return[St,pt]}var wt=t(),Tt=M.define();function Et(e,t,n){let r=T(e.state.doc),a=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!a){D(E,{...o,outcome:`no-target`});return}let s=i(n,`outline`,()=>{e.dispatch({selection:P.cursor(a.from),effects:L.scrollIntoView(a.from,{y:`start`})}),e.focus()});D(E,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Dt(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);i(r,`raw-mdx`,()=>{e.dispatch({selection:P.cursor(o),effects:L.scrollIntoView(o,{y:`center`})}),e.focus()})})}function Ot(e,t,n){let r=e.state.doc,a=Math.min(Math.max(t.line,1),r.lines),o=r.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return i(n,`problems-row`,()=>{e.dispatch({selection:P.cursor(s),effects:L.scrollIntoView(s,{y:`start`})}),e.focus()})}function kt(e){let t=(0,Ve.c)(50),{docName:i,ytext:s,provider:l,placeholder:u,isSourceModeActive:d}=e,f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),[m,re]=(0,Z.useState)(null);if(m)throw m;let{resolvedTheme:g}=h(),{merged:_}=ue(),ie=(0,Z.useRef)(d),v=_?.editor?.wordWrap??!0,{data:y}=je(i),b;t[0]!==y?.effective||t[1]!==_?(b=y?.effective??(_?.contentRules?le(_.contentRules):ce),t[0]=y?.effective,t[1]=_,t[2]=b):b=t[2];let x=b,S;t[3]===x?S=t[4]:(S=JSON.stringify(x),t[3]=x,t[4]=S);let C=S,w,T;t[5]===d?(w=t[6],T=t[7]):(w=()=>{ie.current=d},T=[d],t[5]=d,t[6]=w,t[7]=T),(0,Z.useEffect)(w,T);let O=(0,Z.useRef)(null),k;t[8]!==i||t[9]!==x||t[10]!==u||t[11]!==l||t[12]!==g||t[13]!==v||t[14]!==s?(k=()=>{let e=f.current;if(!e)return;let t=l.configuration.name??``,d,m=jt;try{d=te({docName:t,container:e,sizeStats:{viewCount:0,bytes:s.length},factory:e=>{let c=null,ee=o({ydoc:l.document,ytext:s,docName:t}),d=new A,te=new A,f=new A,ne=new A,p=new L({state:Se.create({doc:s.toString(),extensions:[ot,Je,Fe({scrollToMatch:e=>n(t,`find-match`)?L.scrollIntoView(e,{y:`start`}):Tt.of(null)}),B.of([Ce]),Be(s,l.awareness),B.of(ze),...oe({themeCompartment:d,resolvedTheme:g,ydoc:l.document,wordWrapCompartment:te,wordWrap:v,currentDocName:t}),Ct(),We(t),de(),ne.of(rt(x,i)),nt(i),ee,L.updateListener.of(e=>{r(e)&&a(t)}),L.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(c!==null&&clearTimeout(c),c=setTimeout(()=>{c=null,ye(t,`source`,_e(e.view)),Ae(t,`source`,ke(e.view,t))},120))}),f.of(xe(u??``)),L.theme({"&":{height:`100%`}}),L.scrollMargins.of(At)]}),parent:e});ye(t,`source`,_e(p)),Ae(t,`source`,ke(p,t));let h=p.contentDOM;return h.addEventListener(`keydown`,m),h.addEventListener(`paste`,m),h.addEventListener(`drop`,m),h.addEventListener(`cut`,m),{view:p,ydoc:l.document,ytext:s,provider:l,themeCompartment:d,wordWrapCompartment:te,placeholderCompartment:f,lintCompartment:ne}}}),O.current=d,p.current=d.view,c(i,d.view),be()&&d.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),O.current=null,p.current=null,re(t instanceof Error?t:Error(String(t)))}return()=>{let e=O.current;e&&(ee(e),ne(i,e.view)),O.current=null,p.current=null}},t[8]=i,t[9]=x,t[10]=u,t[11]=l,t[12]=g,t[13]=v,t[14]=s,t[15]=k):k=t[15];let j;t[16]!==l||t[17]!==s?(j=[s,l],t[16]=l,t[17]=s,t[18]=j):j=t[18],(0,Z.useEffect)(k,j);let M,N;t[19]===i?(M=t[20],N=t[21]):(M=()=>{},N=[i],t[19]=i,t[20]=M,t[21]=N),(0,Z.useEffect)(M,N);let P,F;t[22]===g?(P=t[23],F=t[24]):(F=()=>{let e=O.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(g===`dark`?ae:se)})},P=[g],t[22]=g,t[23]=P,t[24]=F),(0,Z.useEffect)(F,P);let I,R;t[25]===v?(I=t[26],R=t[27]):(I=()=>{let e=O.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(v?L.lineWrapping:[])})},R=[v],t[25]=v,t[26]=I,t[27]=R),(0,Z.useEffect)(I,R);let z,V;t[28]===u?(z=t[29],V=t[30]):(z=()=>{let e=O.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(xe(u??``))})},V=[u],t[28]=u,t[29]=z,t[30]=V),(0,Z.useEffect)(z,V);let H;t[31]!==i||t[32]!==x?(H=()=>{let e=O.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(rt(x,i))})},t[31]=i,t[32]=x,t[33]=H):H=t[33];let U;t[34]===C?U=t[35]:(U=[C],t[34]=C,t[35]=U),(0,Z.useEffect)(H,U);let W,G;t[36]!==i||t[37]!==d?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||t.mode!==`source`||!d)return;let n=p.current;if(!n){D(E,{docName:i,mode:`source`,index:t.index,outcome:`no-view`});return}Et(n,t,i),me(i)};return window.addEventListener(he,e),()=>window.removeEventListener(he,e)},G=[i,d],t[36]=i,t[37]=d,t[38]=W,t[39]=G):(W=t[38],G=t[39]),(0,Z.useEffect)(W,G);let K,q;t[40]!==i||t[41]!==d?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||!d)return;let n=p.current;n&&Ot(n,t,i)&&me(i)};return window.addEventListener(ge,e),()=>window.removeEventListener(ge,e)},q=[i,d],t[40]=i,t[41]=d,t[42]=K,t[43]=q):(K=t[42],q=t[43]),(0,Z.useEffect)(K,q);let J,Y;t[44]!==i||t[45]!==d||t[46]!==l?(J=()=>{if(!d)return;let e=p.current;if(!e)return;let t=pe(i);if(!t)return;if(t.kind!==`selection-offset`){fe(i),t.kind===`outline`?Et(e,t.detail,i):t.kind===`lint`?Ot(e,t.detail,i):t.kind===`raw-mdx`&&Dt(e,t.detail,()=>ie.current,i);return}let n=!1,r=null;return queueMicrotask(()=>{if(n)return;let t=pe(i);t?.kind===`selection-offset`&&(r=ve({view:e,docName:i,navigation:t,ydoc:l.document,transition:{from:`wysiwyg`,to:`source`}}),r&&fe(i))}),()=>{n=!0,r?.cancel(`mode-flip`)}},Y=[i,d,l],t[44]=i,t[45]=d,t[46]=l,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,wt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[49]=X):X=t[49],X}function At(){return{top:v()}}function jt(){return _()}export{kt as SourceEditor,Dt as applyRawMdxNavigation};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Dn as n,It as r,Mn as i,Rt as a,U as o,bt as s,gn as c,lt as l,mt as u,nn as ee,st as d,tn as te,ut as f,vn as ne,yt as p}from"./DocumentContext-CZ1LyjXH.js";import{t as m}from"./react-f2sANaYj.js";import{n as h}from"./dist-PQ5KMVDh.js";import{t as re}from"./compiler-runtime-BfE3aGVn.js";import{J as g,M as _,X as ie,a as ae,b as v,i as oe,o as se}from"./CodeMirrorPropInput-Be4UuxHJ.js";import{Po as y,T as ce,Zi as le,oi as b,vo as x,wo as S}from"./dist-As2x8uCt.js";import{i as ue}from"./use-apply-config-theme-CBmHKD_B.js";import{B as de,D as C,F as fe,L as pe,P as me,T as w,d as he,h as ge,i as _e,j as ve,m as T,r as ye,t as be,u as E}from"./typing-burst-detector-BO09cycJ.js";import{s as D}from"./startup-marks-CUyZjhyC.js";import"./config-provider-DWieljqa.js";import{$ as O,D as k,Dt as A,F as j,It as M,Lt as N,Ot as P,Pt as F,Y as I,Z as L,b as R,ct as z,ft as B,g as V,gt as H,ht as xe,it as U,kt as Se,l as W,lt as G,nt as K,pt as q,rt as J,ut as Y,v as X}from"./dist-nQee1FU7.js";import{a as Ce,n as we}from"./cm-theme-MqTIJzgL.js";import{i as Te,n as Ee,o as De,r as Oe}from"./dist-CWdEDKHh.js";import{o as ke,r as Ae}from"./selection-context-BcWEVrAI.js";import{l as je}from"./lint-config-client-CQNYXMfG.js";import{a as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dist-D9xNKL3I2.js";import{n as ze,t as Be}from"./src-B5LNuYlK.js";var Z=e(m(),1),Ve=re();function He(){let e=p();return e===null?null:new Set(e.keys())}function Ue(e,t,n){let r=[],i=j(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);S.lastIndex=0;for(let e=S.exec(t);e!==null;e=S.exec(t)){let t=e[2];if(!y(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.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,s=i.slice(a,i.length-o),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&y(c)&&n!=null)return r.push(I.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=d.exec(s);if(l)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function We(e){let t=f(e);return t===null?[]:[O.fromClass(class{decorations;constructor(e){this.decorations=Ue(e.state,e.visibleRanges,He())}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=Ue(e.view.state,e.view.visibleRanges,He()))}},{decorations:e=>e.decorations}),L.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),i=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(i!==void 0){n.preventDefault();let e=p()?.get(i);return e===void 0?u():window.location.hash=s(i,e),!0}let a=n.target?.closest?.(`.cm-skill-path-link`),o=a instanceof HTMLElement?a.dataset.skillPath:void 0;return o===void 0?!1:(n.preventDefault(),window.location.hash=l(t,e,o),!0)}})]}var Ge=I.line({attributes:{dir:`auto`}});function Ke(e){let t=new F;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,Ge),r=n.to+1}return t.finish()}var qe=O.fromClass(class{decorations;constructor(e){this.decorations=Ke(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Ke(e.view))}},{decorations:e=>e.decorations}),Je=[L.perLineTextDirection.of(!0),qe],Ye=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Xe=`cm-lint-local-target`;function Ze(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 Qe(e,t){let n=V(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Ye.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function $e(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function et(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=Qe(e,Ze(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:$e(i.severity),message:C(i),source:`${i.source}/${i.code}`,markClass:Xe})}return r}var tt=M.define();function nt(e){let t={findings:[]};return[Ne(e=>g()?et(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(tt)))}),O.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:tt.of(null)}),Re(n)},i=w(e,e=>{e.status===`loaded`&&r(e.findings)}),a=ie(()=>r(t.findings));return{destroy(){i(),a()}}})]}function rt(e,t){return e.enabled?[Pe(),Ne(async n=>it(n.state.doc,await b(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 it(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=at(r);o&&(a.actions=[o]),n.push(a)}return n}function at(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 ot=[q(),G(),Y(),X(),J(),U(),Se.allowMultipleSelections.of(!0),k(),W(),Oe(),Ee(),H(),K(),z(),Me(),B.of([...Te,...we,...Le,...R,...De,...Ie])],st=I.mark({class:`cm-link-ref-broken`}),ct=/^\s{0,3}\[([^\]]+)\]:\s/,lt=/\[([^\]]*)\]\[([^\]]*)\]/g,ut=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 dt(e){let t=[];return j(e).iterate({enter(e){if(ut.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function ft(e){let t=new Set,n=[],r=e.doc,i=dt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if($(n.from,i))continue;let a=ct.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)&&!ct.test(t.text))for(lt.lastIndex=0;;){let e=lt.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(st.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var pt=N.define({create(e){return ft(e)},update(e,t){return t.docChanged?ft(t.state):e},provide:e=>L.decorations.from(e)}),mt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,ht=I.mark({class:`cm-del`}),gt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),_t=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function vt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function yt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!x.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(x.test(r.text))return{from:t.from,to:r.to}}return null}function bt(e,t){let n=[],r=j(e),i=yt(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(ht.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=mt.exec(r.text),a=i?i[1].length:2,o=I.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=vt(r.text),a=I.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(gt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(_t.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(_t.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var xt=class{decorations;constructor(e){this.decorations=bt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=bt(e.view.state,e.view.visibleRanges))}},St=O.fromClass(xt,{decorations:e=>e.decorations});function Ct(){return[St,pt]}var wt=t(),Tt=M.define();function Et(e,t,n){let r=T(e.state.doc),a=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!a){D(E,{...o,outcome:`no-target`});return}let s=i(n,`outline`,()=>{e.dispatch({selection:P.cursor(a.from),effects:L.scrollIntoView(a.from,{y:`start`})}),e.focus()});D(E,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Dt(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);i(r,`raw-mdx`,()=>{e.dispatch({selection:P.cursor(o),effects:L.scrollIntoView(o,{y:`center`})}),e.focus()})})}function Ot(e,t,n){let r=e.state.doc,a=Math.min(Math.max(t.line,1),r.lines),o=r.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return i(n,`problems-row`,()=>{e.dispatch({selection:P.cursor(s),effects:L.scrollIntoView(s,{y:`start`})}),e.focus()})}function kt(e){let t=(0,Ve.c)(50),{docName:i,ytext:s,provider:l,placeholder:u,isSourceModeActive:d}=e,f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),[m,re]=(0,Z.useState)(null);if(m)throw m;let{resolvedTheme:g}=h(),{merged:_}=ue(),ie=(0,Z.useRef)(d),v=_?.editor?.wordWrap??!0,{data:y}=je(i),b;t[0]!==y?.effective||t[1]!==_?(b=y?.effective??(_?.contentRules?le(_.contentRules):ce),t[0]=y?.effective,t[1]=_,t[2]=b):b=t[2];let x=b,S;t[3]===x?S=t[4]:(S=JSON.stringify(x),t[3]=x,t[4]=S);let C=S,w,T;t[5]===d?(w=t[6],T=t[7]):(w=()=>{ie.current=d},T=[d],t[5]=d,t[6]=w,t[7]=T),(0,Z.useEffect)(w,T);let O=(0,Z.useRef)(null),k;t[8]!==i||t[9]!==x||t[10]!==u||t[11]!==l||t[12]!==g||t[13]!==v||t[14]!==s?(k=()=>{let e=f.current;if(!e)return;let t=l.configuration.name??``,d,m=jt;try{d=te({docName:t,container:e,sizeStats:{viewCount:0,bytes:s.length},factory:e=>{let c=null,ee=o({ydoc:l.document,ytext:s,docName:t}),d=new A,te=new A,f=new A,ne=new A,p=new L({state:Se.create({doc:s.toString(),extensions:[ot,Je,Fe({scrollToMatch:e=>n(t,`find-match`)?L.scrollIntoView(e,{y:`start`}):Tt.of(null)}),B.of([Ce]),Be(s,l.awareness),B.of(ze),...oe({themeCompartment:d,resolvedTheme:g,ydoc:l.document,wordWrapCompartment:te,wordWrap:v,currentDocName:t}),Ct(),We(t),de(),ne.of(rt(x,i)),nt(i),ee,L.updateListener.of(e=>{r(e)&&a(t)}),L.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(c!==null&&clearTimeout(c),c=setTimeout(()=>{c=null,ye(t,`source`,_e(e.view)),Ae(t,`source`,ke(e.view,t))},120))}),f.of(xe(u??``)),L.theme({"&":{height:`100%`}}),L.scrollMargins.of(At)]}),parent:e});ye(t,`source`,_e(p)),Ae(t,`source`,ke(p,t));let h=p.contentDOM;return h.addEventListener(`keydown`,m),h.addEventListener(`paste`,m),h.addEventListener(`drop`,m),h.addEventListener(`cut`,m),{view:p,ydoc:l.document,ytext:s,provider:l,themeCompartment:d,wordWrapCompartment:te,placeholderCompartment:f,lintCompartment:ne}}}),O.current=d,p.current=d.view,c(i,d.view),be()&&d.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),O.current=null,p.current=null,re(t instanceof Error?t:Error(String(t)))}return()=>{let e=O.current;e&&(ee(e),ne(i,e.view)),O.current=null,p.current=null}},t[8]=i,t[9]=x,t[10]=u,t[11]=l,t[12]=g,t[13]=v,t[14]=s,t[15]=k):k=t[15];let j;t[16]!==l||t[17]!==s?(j=[s,l],t[16]=l,t[17]=s,t[18]=j):j=t[18],(0,Z.useEffect)(k,j);let M,N;t[19]===i?(M=t[20],N=t[21]):(M=()=>{},N=[i],t[19]=i,t[20]=M,t[21]=N),(0,Z.useEffect)(M,N);let P,F;t[22]===g?(P=t[23],F=t[24]):(F=()=>{let e=O.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(g===`dark`?ae:se)})},P=[g],t[22]=g,t[23]=P,t[24]=F),(0,Z.useEffect)(F,P);let I,R;t[25]===v?(I=t[26],R=t[27]):(I=()=>{let e=O.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(v?L.lineWrapping:[])})},R=[v],t[25]=v,t[26]=I,t[27]=R),(0,Z.useEffect)(I,R);let z,V;t[28]===u?(z=t[29],V=t[30]):(z=()=>{let e=O.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(xe(u??``))})},V=[u],t[28]=u,t[29]=z,t[30]=V),(0,Z.useEffect)(z,V);let H;t[31]!==i||t[32]!==x?(H=()=>{let e=O.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(rt(x,i))})},t[31]=i,t[32]=x,t[33]=H):H=t[33];let U;t[34]===C?U=t[35]:(U=[C],t[34]=C,t[35]=U),(0,Z.useEffect)(H,U);let W,G;t[36]!==i||t[37]!==d?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||t.mode!==`source`||!d)return;let n=p.current;if(!n){D(E,{docName:i,mode:`source`,index:t.index,outcome:`no-view`});return}Et(n,t,i),me(i)};return window.addEventListener(he,e),()=>window.removeEventListener(he,e)},G=[i,d],t[36]=i,t[37]=d,t[38]=W,t[39]=G):(W=t[38],G=t[39]),(0,Z.useEffect)(W,G);let K,q;t[40]!==i||t[41]!==d?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||!d)return;let n=p.current;n&&Ot(n,t,i)&&me(i)};return window.addEventListener(ge,e),()=>window.removeEventListener(ge,e)},q=[i,d],t[40]=i,t[41]=d,t[42]=K,t[43]=q):(K=t[42],q=t[43]),(0,Z.useEffect)(K,q);let J,Y;t[44]!==i||t[45]!==d||t[46]!==l?(J=()=>{if(!d)return;let e=p.current;if(!e)return;let t=pe(i);if(!t)return;if(t.kind!==`selection-offset`){fe(i),t.kind===`outline`?Et(e,t.detail,i):t.kind===`lint`?Ot(e,t.detail,i):t.kind===`raw-mdx`&&Dt(e,t.detail,()=>ie.current,i);return}let n=!1,r=null;return queueMicrotask(()=>{if(n)return;let t=pe(i);t?.kind===`selection-offset`&&(r=ve({view:e,docName:i,navigation:t,ydoc:l.document,transition:{from:`wysiwyg`,to:`source`}}),r&&fe(i))}),()=>{n=!0,r?.cancel(`mode-flip`)}},Y=[i,d,l],t[44]=i,t[45]=d,t[46]=l,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,wt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[49]=X):X=t[49],X}function At(){return{top:v()}}function jt(){return _()}export{kt as SourceEditor,Dt as applyRawMdxNavigation};
|