@inkeep/open-knowledge 0.33.0-beta.7 → 0.33.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +7 -7
  4. package/dist/config-schema.json +3 -3
  5. package/dist/config.project-local.schema.json +3 -3
  6. package/dist/constants-DhO9HwoR.mjs +2 -0
  7. package/dist/{dist-petOQDm6.mjs → dist-ByRE-TiH.mjs} +6 -6
  8. package/dist/{dist-gqZDYmIG.mjs → dist-CCGDZSiV.mjs} +2 -2
  9. package/dist/{dist-DNDjbkqL.mjs → dist-CPJ9FkgX.mjs} +1 -1
  10. package/dist/{gh-detect-DT6DqKGM.mjs → gh-detect-DRASN_qx.mjs} +2 -2
  11. package/dist/git-handle-CetHWc5A-BpfHLi3S.mjs +1 -0
  12. package/dist/{git-handle-dKyep_oZ-B7s7m6CJ.mjs → git-handle-dKyep_oZ-eDHPK5PI.mjs} +2 -2
  13. package/dist/index.mjs +1 -1
  14. package/dist/{init-KCSJffNW.mjs → init-BGjbl-F7.mjs} +3 -3
  15. package/dist/init-sNMP_ZQL.mjs +1 -0
  16. package/dist/{launch-json-removal-ZIYJbZtQ.mjs → launch-json-removal-BkOXBtkU.mjs} +2 -2
  17. package/dist/{loader-BqECoP19.mjs → loader-C0JuN2jI.mjs} +2 -2
  18. package/dist/loader-ECrQWruE.mjs +1 -0
  19. package/dist/{open-browser-BMVg3r9e.mjs → open-browser-DNqvAiIh.mjs} +2 -2
  20. package/dist/preview-C1BQRhhO.mjs +1 -0
  21. package/dist/{preview-Bmngkbmx.mjs → preview-mEnD1Tq1.mjs} +2 -2
  22. package/dist/public/assets/{ActivityModeContent-Cxs8_d9h.js → ActivityModeContent-jsCTPiun.js} +1 -1
  23. package/dist/public/assets/{CodeMirrorPropInput-f5pC607I.js → CodeMirrorPropInput-cmSiPzan.js} +1 -1
  24. package/dist/public/assets/{DocumentContext-ogFq9Apo.js → DocumentContext-CNzSFsI-.js} +1 -1
  25. package/dist/public/assets/{EnableSyncConfirmDialog-CEMiBdy3.js → EnableSyncConfirmDialog-D_NbuJ59.js} +1 -1
  26. package/dist/public/assets/{GraphPanel-CT4Uax7w.js → GraphPanel-BrqHgLjs.js} +1 -1
  27. package/dist/public/assets/{ManagedArtifactProperties-BfEt7bIb.js → ManagedArtifactProperties-DqTT5fPT.js} +1 -1
  28. package/dist/public/assets/{McpConsentDialogBody-DoSFKWJ-.js → McpConsentDialogBody-BrfdQb16.js} +1 -1
  29. package/dist/public/assets/{MermaidDocEditor-CJFsgS7x.js → MermaidDocEditor-B_dNhePY.js} +1 -1
  30. package/dist/public/assets/{PropertyPanel-DpYcGGW2.js → PropertyPanel-Dkz1gPoU.js} +1 -1
  31. package/dist/public/assets/{ReportBugDialogBody-C0pCt3Po.js → ReportBugDialogBody-CCKV6nZY.js} +1 -1
  32. package/dist/public/assets/{SettingsDialogBody-04WyfuHT.js → SettingsDialogBody-BxTayjY8.js} +1 -1
  33. package/dist/public/assets/{ShareBranchSwitchDialog-DGcSbhKt.js → ShareBranchSwitchDialog-BhekOXUp.js} +1 -1
  34. package/dist/public/assets/{ShareReceiveDialog-Dp0wMb0C.js → ShareReceiveDialog-o5dNBk6Q.js} +1 -1
  35. package/dist/public/assets/{ShareReceiveMissDialog-BaOnOALv.js → ShareReceiveMissDialog-UODMw9si.js} +1 -1
  36. package/dist/public/assets/{SkillEditorActions-RqGqr20K.js → SkillEditorActions-euGEb-E6.js} +1 -1
  37. package/dist/public/assets/{SourceEditor-DeLqYSaV.js → SourceEditor-CORtf1FY.js} +1 -1
  38. package/dist/public/assets/{TerminalPanel-D93QQMrM.js → TerminalPanel-g64JYtbc.js} +1 -1
  39. package/dist/public/assets/{agent-presence-D2eASrH_.js → agent-presence-D3uA1hrz.js} +1 -1
  40. package/dist/public/assets/{auth-state-cache-CijiQXmK.js → auth-state-cache-DCv4Whjc.js} +1 -1
  41. package/dist/public/assets/{config-provider-BGFykK9q.js → config-provider-DVy-GqC5.js} +1 -1
  42. package/dist/public/assets/{dist-CurDB4OA.js → dist-DkRtDyLN.js} +1 -1
  43. package/dist/public/assets/{dist-TX_NQU76.js → dist-Dl_HewkW.js} +1 -1
  44. package/dist/public/assets/{doc-hash-CZiGDoto.js → doc-hash-BDRwCcvB.js} +1 -1
  45. package/dist/public/assets/{documents-events-BgIyZo2W.js → documents-events-CJpJUM_N.js} +1 -1
  46. package/dist/public/assets/{file-tree-adapter-Dubqn9yJ.js → file-tree-adapter-_1h6_EGw.js} +1 -1
  47. package/dist/public/assets/{index-CxZGz7om.js → index-FValh7LC.js} +8 -8
  48. package/dist/public/assets/{lint-config-client-VuF6BI2d.js → lint-config-client-CX_cssoL.js} +1 -1
  49. package/dist/public/assets/{navigation-targets-D_g_oD3p.js → navigation-targets-S-8o5DE_.js} +1 -1
  50. package/dist/public/assets/{open-managed-artifact-tab-jUT5uxaf.js → open-managed-artifact-tab-tiXawScj.js} +1 -1
  51. package/dist/public/assets/{pending-receive-nav-store-BqFe0QyH.js → pending-receive-nav-store-BUhyCKTL.js} +1 -1
  52. package/dist/public/assets/{prop-types-r4lrTXmC.js → prop-types-Cr0Uib4q.js} +1 -1
  53. package/dist/public/assets/{receive-store-DL3XQSe9.js → receive-store-DYDEnyEg.js} +1 -1
  54. package/dist/public/assets/{selection-context-DRS0xWzo.js → selection-context-BjmeTT0v.js} +1 -1
  55. package/dist/public/assets/{skill-actions-CqFXEGI_.js → skill-actions-32qU2dgG.js} +1 -1
  56. package/dist/public/assets/{skills-api-ChqmqNEn.js → skills-api-UJqRM51N.js} +1 -1
  57. package/dist/public/assets/{src-B_OV9KU-.js → src-CBkac3Ms.js} +1 -1
  58. package/dist/public/assets/{target-navigation-intent-CYYSTgIq.js → target-navigation-intent-BFsJN8Kr.js} +1 -1
  59. package/dist/public/assets/{typing-burst-detector-ByylQ2W5.js → typing-burst-detector-CekoPsaO.js} +1 -1
  60. package/dist/public/assets/{use-apply-config-color-theme-DJU29ygF.js → use-apply-config-color-theme-CUJwxTbn.js} +1 -1
  61. package/dist/public/assets/{workspace-paths-DGpjh0_R.js → workspace-paths-r1tSwfOd.js} +1 -1
  62. package/dist/public/index.html +26 -26
  63. package/dist/{repair-launch-json-D73FezU-.mjs → repair-launch-json-DX3G-SfV.mjs} +2 -2
  64. package/dist/{repair-mcp-configs-C2iq9bOP.mjs → repair-mcp-configs-CUHrcUTa.mjs} +2 -2
  65. package/dist/{repair-skills-BSRgI3Qd.mjs → repair-skills-BLdSucBd.mjs} +2 -2
  66. package/dist/repair-skills-BOkpuUWV.mjs +1 -0
  67. package/dist/schemas/v0/config.project-local.schema.json +3 -3
  68. package/dist/server-lock-GuuouVft-BJoBhhhn.mjs +1 -0
  69. package/dist/{server-lock-iLcBw_q0-CSsXlPB8.mjs → server-lock-iLcBw_q0-Bmk5FT76.mjs} +2 -2
  70. package/dist/{src-7LGO0Yau.mjs → src-Bzia_wR-.mjs} +2 -2
  71. package/dist/{start-CGL0pAPp.mjs → start-B3oqzXtV.mjs} +2 -2
  72. package/dist/start-DMf1yZZ6.mjs +1 -0
  73. package/dist/{write-project-skill-CQSo7jpP.mjs → write-project-skill-0vVDpckX.mjs} +2 -2
  74. package/package.json +1 -1
  75. package/dist/constants-B18JyjBC.mjs +0 -2
  76. package/dist/git-handle-CetHWc5A-BcCPg15N.mjs +0 -1
  77. package/dist/init-zkouBkiU.mjs +0 -1
  78. package/dist/loader-D9ILq_Qj.mjs +0 -1
  79. package/dist/preview-CXetnprU.mjs +0 -1
  80. package/dist/repair-skills-DMIeifIr.mjs +0 -1
  81. package/dist/server-lock-GuuouVft-mEG_NG6z.mjs +0 -1
  82. package/dist/start-B3G01qdc.mjs +0 -1
@@ -1 +1 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{n as i,r as a}from"./dist-UKzQrqGt.js";import{n as o}from"./createLucideIcon-DkO1lL_8.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-DFGKErvF.js";import{n as se,t as s}from"./git-branch-D6_3xkgC.js";import{t as c}from"./loader-circle-CLDbHvUo.js";import{n as ce,t as le}from"./miss-dialog-store-CyOCdXFw.js";import{n as l}from"./dist-DyPw7rC6.js";import{t as u}from"./desktop-bridge-types-_D7JSBL8.js";import{n as d}from"./worktree-store-DFmh2OE1.js";import{a as f,n as ue}from"./receive-store-DL3XQSe9.js";import{t as de}from"./share-metadata-rows-z85jCRiH.js";var p=e(t(),1),fe=r();function pe(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 me(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function m(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 he={phase:`loading`};function ge(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _e(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ve(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ye(e){return pe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function be(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function xe(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 Se(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=m(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 Ce(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}}:{state:e}}var h=n();function we(e){return e!==null&&e.kind===`project-branch-switch`}function g(e){let t=(0,fe.c)(217),{bridge:n,store:r}=e,m=r===void 0?ue:r,{_:g}=a(),_=(0,p.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[v,y]=(0,p.useState)(he),Me=(0,p.useRef)(!1),Ne=(0,p.useRef)(!1),Pe=(0,p.useRef)(!1),Fe=(0,p.useRef)(null),Ie;t[0]===_?Ie=t[1]:(Ie=we(_)?_:null,t[0]=_,t[1]=Ie);let b=Ie,Le;t[2]!==g||t[3]!==b?.share.target.kind?(Le=b?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=b?.share.target.kind,t[4]=Le):Le=t[4];let x=Le,Re;t[5]===b?Re=t[6]:(Re=()=>{y(he),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=b},t[5]=b,t[6]=Re);let ze;t[7]===_?ze=t[8]:(ze=[_],t[7]=_,t[8]=ze),(0,p.useEffect)(Re,ze);let Be;t[9]!==b||t[10]!==n?(Be=()=>{if(!b||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{e||y(e=>ge(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),y(Ae))}),()=>{e=!0}},t[9]=b,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===b?Ve=t[13]:(Ve=[b],t[12]=b,t[13]=Ve),(0,p.useEffect)(Be,Ve);let He;t[14]!==b||t[15]!==v.info||t[16]!==v.phase||t[17]!==n?(He=()=>{if(!b||v.phase!==`ready`||Pe.current||!ye(v.info))return;Pe.current=!0,y(be);let e=b;n.project.fetchTargetStatus({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{Fe.current===e&&y(e=>xe(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),y(ke))})},t[14]=b,t[15]=v.info,t[16]=v.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==b||t[20]!==v.phase?(Ue=[v.phase,b],t[19]=b,t[20]=v.phase,t[21]=Ue):Ue=t[21],(0,p.useEffect)(He,Ue);let We;t[22]!==b||t[23]!==v.phase||t[24]!==v.resolution||t[25]!==m?(We=()=>{if(v.phase!==`verdict`)return;let{kind:e}=v.resolution;e!==`deleted`&&e!==`never-on-branch`||b&&(le.arm({kind:b.share.target.kind,path:u(b.share.target),branch:b.share.branch}),m.dismiss())},t[22]=b,t[23]=v.phase,t[24]=v.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==b||t[28]!==v||t[29]!==m?(Ge=[v,b,m],t[27]=b,t[28]=v,t[29]=m,t[30]=Ge):Ge=t[30],(0,p.useEffect)(We,Ge);let Ke;t[31]!==v.phase||t[32]!==v.resolution?(Ke=()=>{v.phase===`verdict`&&console.log(f({verdict_cell:v.resolution.kind}))},t[31]=v.phase,t[32]=v.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===v?qe=t[35]:(qe=[v],t[34]=v,t[35]=qe),(0,p.useEffect)(Ke,qe);let Je;t[36]!==g||t[37]!==b||t[38]!==v.pendingDoc||t[39]!==v.phase||t[40]!==n||t[41]!==m||t[42]!==x?(Je=()=>{if(v.phase!==`awaiting-cc1-recycle`||!b)return;let e=b.share.branch,t=v.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:b.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:b.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:b.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(g({id:`gQV-9w`,values:{targetNoun:x}}))}),m.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(g({id:`LBwUR6`,values:{targetNoun:x}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(g({id:`Jw6EC4`,values:{targetNoun:x}})),m.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=b,t[38]=v.pendingDoc,t[39]=v.phase,t[40]=n,t[41]=m,t[42]=x,t[43]=Je):Je=t[43];let Ye;if(t[44]!==b||t[45]!==v.phase?(Ye=[v.phase,b],t[44]=b,t[45]=v.phase,t[46]=Ye):Ye=t[46],(0,p.useEffect)(Je,Ye),!b)return null;let{share:S,projectPath:C,currentBranch:w}=b,T=S.branch,Xe;t[47]!==g||t[48]!==n.project||t[49]!==C||t[50]!==T||t[51]!==m?(Xe=function(e,t,r){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),y(t=>_e(t,e)),n.project.runCheckout(t?{projectPath:C,branch:T,fastForward:!0}:{projectPath:C,branch:T}).then(e=>{let t=null,n=!1;y(r=>{let{state:i,sideEffect:a}=Se(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(g({id:`NJyQi_`,values:{shareBranch:T}})):t===`fetch-failed`?l.error(g({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(g({id:`c863eW`,values:{shareBranch:T}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),y(Oe),l.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=C,t[50]=T,t[51]=m,t[52]=Xe):Xe=t[52];let E=Xe,Ze;t[53]!==v.info||t[54]!==v.phase||t[55]!==E||t[56]!==S.target?(Ze=function(){v.phase===`ready`&&pe(v.info).switchEnabled&&E(u(S.target),!1)},t[53]=v.info,t[54]=v.phase,t[55]=E,t[56]=S.target,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==v.phase||t[59]!==v.resolution||t[60]!==E||t[61]!==S.target?($e=function(){v.phase===`verdict`&&E(u(S.target),!0,v.resolution.kind)},t[58]=v.phase,t[59]=v.resolution,t[60]=E,t[61]=S.target,t[62]=$e):$e=t[62];let et=$e,tt;t[63]!==v.phase||t[64]!==v.resolution||t[65]!==E?(tt=function(){v.phase===`verdict`&&v.resolution.kind===`renamed`&&E(v.resolution.renamedTo,!0,v.resolution.kind)},t[63]=v.phase,t[64]=v.resolution,t[65]=E,t[66]=tt):tt=t[66];let nt=tt,rt;t[67]!==v.phase||t[68]!==v.resolution||t[69]!==E||t[70]!==S.target?(rt=function(){v.phase===`verdict`&&E(u(S.target),!1,v.resolution.kind)},t[67]=v.phase,t[68]=v.resolution,t[69]=E,t[70]=S.target,t[71]=rt):rt=t[71];let it=rt,at;t[72]!==g||t[73]!==n.project||t[74]!==C||t[75]!==S.target||t[76]!==T||t[77]!==m||t[78]!==x?(at=function(){console.log(f({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:C,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(g({id:`b5aNbi`,values:{targetNoun:x}}))}),m.dismiss()},t[72]=g,t[73]=n.project,t[74]=C,t[75]=S.target,t[76]=T,t[77]=m,t[78]=x,t[79]=at):at=t[79];let ot=at,st;t[80]!==g||t[81]!==T?(st=function(e,t){switch(e){case`helper-not-found`:{let e=t??g({id:`cHhH3i`});l.error(g({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:l.error(g({id:`NJyQi_`,values:{shareBranch:T}}));return;case`fetch-failed`:l.error(g({id:`bWLmRK`}));return;case`already-checked-out`:l.error(g({id:`ljHjfg`}));return;case`branch-exists`:l.error(g({id:`h3QZcB`,values:{shareBranch:T}}));return;case`path-exists`:l.error(g({id:`cN1Gcp`,values:{shareBranch:T}}));return;case`no-git`:l.error(g({id:`CFnavk`}));return;case`invalid-branch`:l.error(g({id:`JfPuv7`,values:{shareBranch:T}}));return;case`proxy-null`:case`error`:l.error(g({id:`e8zYa8`,values:{shareBranch:T}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=g,t[81]=T,t[82]=st):st=t[82];let ct=st,lt;t[83]!==g||t[84]!==n.project||t[85]!==S.target||t[86]!==T||t[87]!==ct||t[88]!==m?(lt=function(e){let t=null,r,i=!1,a=null;if(y(n=>{let{state:o,sideEffect:ee}=Ce(n,e);return ee&&(t=ee.reason,r=ee.helper,i=o.phase===`dismissed`),o.phase===`opening-worktree`&&(a=o.path),o}),t!==null&&(console.log(f({branch_dialog_action:`open-worktree-failed:${t}`,branch:T})),ct(t,r)),a!==null){d();let e=a;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}i&&m.dismiss()},t[83]=g,t[84]=n.project,t[85]=S.target,t[86]=T,t[87]=ct,t[88]=m,t[89]=lt):lt=t[89];let ut=lt,dt;t[90]!==ut||t[91]!==v.phase||t[92]!==n.worktree||t[93]!==T?(dt=function(){v.phase===`ready`&&(console.log(f({branch_dialog_action:`open-worktree`,branch:T})),y(ve),n.worktree.checkout({branch:T}).then(e=>{ut(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ut(null)}))},t[90]=ut,t[91]=v.phase,t[92]=n.worktree,t[93]=T,t[94]=dt):dt=t[94];let ft=dt,pt;t[95]!==g||t[96]!==v.otherWorktreePath||t[97]!==v.phase||t[98]!==n.project||t[99]!==S.target||t[100]!==T||t[101]!==m?(pt=function(){if(v.phase!==`branch-in-other-worktree`)return;let e=v.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=g,t[96]=v.otherWorktreePath,t[97]=v.phase,t[98]=n.project,t[99]=S.target,t[100]=T,t[101]=m,t[102]=pt):pt=t[102];let mt=pt,ht;t[103]!==v.phase||t[104]!==v.resolution||t[105]!==m?(ht=function(){console.log(f({branch_dialog_action:`cancel`,verdict_cell:v.phase===`verdict`?v.resolution.kind:void 0})),m.dismiss()},t[103]=v.phase,t[104]=v.resolution,t[105]=m,t[106]=ht):ht=t[106];let D=ht,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K;if(t[107]!==g||t[108]!==v.info||t[109]!==v.otherWorktreePath||t[110]!==v.phase||t[111]!==v.resolution||t[112]!==D||t[113]!==w||t[114]!==S.branch||t[115]!==S.owner||t[116]!==S.repo||t[117]!==S.target||t[118]!==T||t[119]!==x){G=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?pe(v.info):null;let e;t[139]!==v.info||t[140]!==v.phase||t[141]!==w?(e=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?me(v.info):w??`HEAD`,t[139]=v.info,t[140]=v.phase,t[141]=w,t[142]=e):e=t[142];let n=e;P=v.phase===`switching`||v.phase===`awaiting-cc1-recycle`,j=v.phase===`creating-worktree`;let r;t[143]===g?r=t[144]:(r=g({id:`OuY8t9`}),t[143]=g,t[144]=r),M=r;let a;t[145]===g?a=t[146]:(a=g({id:`XZkdtg`}),t[145]=g,t[146]=a),N=a;let o;t[147]===g?o=t[148]:(o=g({id:`VTulZj`}),t[147]=g,t[148]=o),K=o;let ie=v.phase===`loading`,se=v.phase===`error`;A=oe,U=!0,t[149]===D?W=t[150]:(W=e=>{e||D()},t[149]=D,t[150]=W),k=ne,R=`sm:max-w-xl`,z=`share-branch-switch-dialog`,B=De,V=Ee;let s;t[151]===x?s=t[152]:(s=(0,h.jsx)(te,{children:(0,h.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:x}})}),t[151]=x,t[152]=s);let ce=S.owner,le=S.repo,l;t[153]===S.target?l=t[154]:(l=u(S.target),t[153]=S.target,t[154]=l);let d;t[155]!==S.owner||t[156]!==S.repo||t[157]!==l?(d=(0,h.jsx)(ee,{className:`sr-only`,children:(0,h.jsx)(i,{id:`f8jU-L`,values:{0:ce,1:le,2:l}})}),t[155]=S.owner,t[156]=S.repo,t[157]=l,t[158]=d):d=t[158],t[159]!==s||t[160]!==d?(H=(0,h.jsxs)(ae,{children:[s,d]}),t[159]=s,t[160]=d,t[161]=H):H=t[161],O=re;let f=S.owner,ue=S.repo,p;t[162]===S.target?p=t[163]:(p=u(S.target),t[162]=S.target,t[163]=p),t[164]!==S.branch||t[165]!==S.owner||t[166]!==S.repo||t[167]!==S.target.kind||t[168]!==p?(F=(0,h.jsx)(`div`,{className:`mb-4`,children:(0,h.jsx)(de,{owner:f,repo:ue,path:p,kind:S.target.kind,branch:S.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=S.branch,t[165]=S.owner,t[166]=S.repo,t[167]=S.target.kind,t[168]=p,t[169]=F):F=t[169],I=v.phase===`branch-in-other-worktree`?(0,h.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,h.jsx)(`p`,{className:`leading-6`,children:(0,h.jsx)(i,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,h.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:v.otherWorktreePath})]}):v.phase===`verdict-pending`?(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`c8jBgX`})]}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,h.jsx)(i,{id:`Uay5NL`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`renamed`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,h.jsx)(i,{id:`P0HC30`,values:{0:v.resolution.renamedTo,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`diverged`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,h.jsx)(i,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`c8jBgX`})]}):ie?(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`jerqF0`})]}):se?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,h.jsx)(i,{id:`w4hMYl`})}):G?.kind===`D`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`DTI-fp`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`sZ2IOu`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`_902BE`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,h.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,h.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,h.jsx)(i,{id:`n2lRue`})}),(0,h.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:G.conflictingFiles.map(Te)})]}):null,t[107]=g,t[108]=v.info,t[109]=v.otherWorktreePath,t[110]=v.phase,t[111]=v.resolution,t[112]=D,t[113]=w,t[114]=S.branch,t[115]=S.owner,t[116]=S.repo,t[117]=S.target,t[118]=T,t[119]=x,t[120]=O,t[121]=k,t[122]=A,t[123]=j,t[124]=M,t[125]=N,t[126]=P,t[127]=F,t[128]=I,t[129]=L,t[130]=R,t[131]=z,t[132]=B,t[133]=V,t[134]=H,t[135]=U,t[136]=W,t[137]=G,t[138]=K}else O=t[120],k=t[121],A=t[122],j=t[123],M=t[124],N=t[125],P=t[126],F=t[127],I=t[128],L=t[129],R=t[130],z=t[131],B=t[132],V=t[133],H=t[134],U=t[135],W=t[136],G=t[137],K=t[138];let q;t[170]===P?q=t[171]:(q=P?(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`PZtgO0`})]}):null,t[172]=j,t[173]=J);let Y;t[174]!==O||t[175]!==F||t[176]!==I||t[177]!==L||t[178]!==q||t[179]!==J?(Y=(0,h.jsxs)(O,{children:[F,I,L,q,J]}),t[174]=O,t[175]=F,t[176]=I,t[177]=L,t[178]=q,t[179]=J,t[180]=Y):Y=t[180];let gt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,h.jsx)(i,{id:`dEgA5A`}),t[181]=gt):gt=t[181];let X;t[182]===D?X=t[183]:(X=(0,h.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:gt}),t[182]=D,t[183]=X);let Z;t[184]!==v.phase||t[185]!==v.resolution||t[186]!==j||t[187]!==ot||t[188]!==nt||t[189]!==ft||t[190]!==mt||t[191]!==it||t[192]!==Qe||t[193]!==et||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=v.phase===`branch-in-other-worktree`?(0,h.jsx)(o,{onClick:mt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,h.jsx)(i,{id:`hyCxJY`})}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsxs)(o,{onClick:et,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(i,{id:`uA_jXp`})]}):v.resolution.kind===`renamed`?(0,h.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(i,{id:`AItsE5`})]}):v.resolution.kind===`diverged`?(0,h.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,h.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:[G?.openCurrentEnabled?(0,h.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ot,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,h.jsx)(o,{variant:`outline`,onClick:Qe,disabled:!G?.switchEnabled||P||j,"aria-disabled":!G?.switchEnabled||P||j,"aria-describedby":G&&!G.switchEnabled&&G.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:P?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),N]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,h.jsx)(o,{onClick:ft,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),K]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=v.phase,t[185]=v.resolution,t[186]=j,t[187]=ot,t[188]=nt,t[189]=ft,t[190]=mt,t[191]=it,t[192]=Qe,t[193]=et,t[194]=M,t[195]=N,t[196]=P,t[197]=G,t[198]=K,t[199]=Z):Z=t[199];let Q;t[200]!==X||t[201]!==Z?(Q=(0,h.jsxs)(ie,{className:`sm:justify-between`,children:[X,Z]}),t[200]=X,t[201]=Z,t[202]=Q):Q=t[202];let $;t[203]!==k||t[204]!==R||t[205]!==z||t[206]!==B||t[207]!==V||t[208]!==H||t[209]!==Y||t[210]!==Q?($=(0,h.jsxs)(k,{className:R,"data-testid":z,onInteractOutside:B,onPointerDownOutside:V,children:[H,Y,Q]}),t[203]=k,t[204]=R,t[205]=z,t[206]=B,t[207]=V,t[208]=H,t[209]=Y,t[210]=Q,t[211]=$):$=t[211];let _t;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(_t=(0,h.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=_t):_t=t[216],_t}function Te(e){return(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(e){return Se(e,null).state}function ke(e){return xe(e,null)}function Ae(e){return ge(e,null)}function je(){return null}export{g as ShareBranchSwitchDialog};
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{n as i,r as a}from"./dist-UKzQrqGt.js";import{n as o}from"./createLucideIcon-DkO1lL_8.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-DFGKErvF.js";import{n as se,t as s}from"./git-branch-D6_3xkgC.js";import{t as c}from"./loader-circle-CLDbHvUo.js";import{n as ce,t as le}from"./miss-dialog-store-CyOCdXFw.js";import{n as l}from"./dist-DyPw7rC6.js";import{t as u}from"./desktop-bridge-types-_D7JSBL8.js";import{n as d}from"./worktree-store-DFmh2OE1.js";import{a as f,n as ue}from"./receive-store-DYDEnyEg.js";import{t as de}from"./share-metadata-rows-z85jCRiH.js";var p=e(t(),1),fe=r();function pe(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 me(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function m(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 he={phase:`loading`};function ge(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _e(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ve(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ye(e){return pe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function be(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function xe(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 Se(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=m(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 Ce(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}}:{state:e}}var h=n();function we(e){return e!==null&&e.kind===`project-branch-switch`}function g(e){let t=(0,fe.c)(217),{bridge:n,store:r}=e,m=r===void 0?ue:r,{_:g}=a(),_=(0,p.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[v,y]=(0,p.useState)(he),Me=(0,p.useRef)(!1),Ne=(0,p.useRef)(!1),Pe=(0,p.useRef)(!1),Fe=(0,p.useRef)(null),Ie;t[0]===_?Ie=t[1]:(Ie=we(_)?_:null,t[0]=_,t[1]=Ie);let b=Ie,Le;t[2]!==g||t[3]!==b?.share.target.kind?(Le=b?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=b?.share.target.kind,t[4]=Le):Le=t[4];let x=Le,Re;t[5]===b?Re=t[6]:(Re=()=>{y(he),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=b},t[5]=b,t[6]=Re);let ze;t[7]===_?ze=t[8]:(ze=[_],t[7]=_,t[8]=ze),(0,p.useEffect)(Re,ze);let Be;t[9]!==b||t[10]!==n?(Be=()=>{if(!b||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{e||y(e=>ge(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),y(Ae))}),()=>{e=!0}},t[9]=b,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===b?Ve=t[13]:(Ve=[b],t[12]=b,t[13]=Ve),(0,p.useEffect)(Be,Ve);let He;t[14]!==b||t[15]!==v.info||t[16]!==v.phase||t[17]!==n?(He=()=>{if(!b||v.phase!==`ready`||Pe.current||!ye(v.info))return;Pe.current=!0,y(be);let e=b;n.project.fetchTargetStatus({projectPath:b.projectPath,branch:b.share.branch,kind:b.share.target.kind,path:u(b.share.target)}).then(t=>{Fe.current===e&&y(e=>xe(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),y(ke))})},t[14]=b,t[15]=v.info,t[16]=v.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==b||t[20]!==v.phase?(Ue=[v.phase,b],t[19]=b,t[20]=v.phase,t[21]=Ue):Ue=t[21],(0,p.useEffect)(He,Ue);let We;t[22]!==b||t[23]!==v.phase||t[24]!==v.resolution||t[25]!==m?(We=()=>{if(v.phase!==`verdict`)return;let{kind:e}=v.resolution;e!==`deleted`&&e!==`never-on-branch`||b&&(le.arm({kind:b.share.target.kind,path:u(b.share.target),branch:b.share.branch}),m.dismiss())},t[22]=b,t[23]=v.phase,t[24]=v.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==b||t[28]!==v||t[29]!==m?(Ge=[v,b,m],t[27]=b,t[28]=v,t[29]=m,t[30]=Ge):Ge=t[30],(0,p.useEffect)(We,Ge);let Ke;t[31]!==v.phase||t[32]!==v.resolution?(Ke=()=>{v.phase===`verdict`&&console.log(f({verdict_cell:v.resolution.kind}))},t[31]=v.phase,t[32]=v.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===v?qe=t[35]:(qe=[v],t[34]=v,t[35]=qe),(0,p.useEffect)(Ke,qe);let Je;t[36]!==g||t[37]!==b||t[38]!==v.pendingDoc||t[39]!==v.phase||t[40]!==n||t[41]!==m||t[42]!==x?(Je=()=>{if(v.phase!==`awaiting-cc1-recycle`||!b)return;let e=b.share.branch,t=v.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:b.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:b.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:b.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(g({id:`gQV-9w`,values:{targetNoun:x}}))}),m.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(g({id:`LBwUR6`,values:{targetNoun:x}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(g({id:`Jw6EC4`,values:{targetNoun:x}})),m.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=b,t[38]=v.pendingDoc,t[39]=v.phase,t[40]=n,t[41]=m,t[42]=x,t[43]=Je):Je=t[43];let Ye;if(t[44]!==b||t[45]!==v.phase?(Ye=[v.phase,b],t[44]=b,t[45]=v.phase,t[46]=Ye):Ye=t[46],(0,p.useEffect)(Je,Ye),!b)return null;let{share:S,projectPath:C,currentBranch:w}=b,T=S.branch,Xe;t[47]!==g||t[48]!==n.project||t[49]!==C||t[50]!==T||t[51]!==m?(Xe=function(e,t,r){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),y(t=>_e(t,e)),n.project.runCheckout(t?{projectPath:C,branch:T,fastForward:!0}:{projectPath:C,branch:T}).then(e=>{let t=null,n=!1;y(r=>{let{state:i,sideEffect:a}=Se(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(g({id:`NJyQi_`,values:{shareBranch:T}})):t===`fetch-failed`?l.error(g({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(g({id:`c863eW`,values:{shareBranch:T}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),y(Oe),l.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=C,t[50]=T,t[51]=m,t[52]=Xe):Xe=t[52];let E=Xe,Ze;t[53]!==v.info||t[54]!==v.phase||t[55]!==E||t[56]!==S.target?(Ze=function(){v.phase===`ready`&&pe(v.info).switchEnabled&&E(u(S.target),!1)},t[53]=v.info,t[54]=v.phase,t[55]=E,t[56]=S.target,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==v.phase||t[59]!==v.resolution||t[60]!==E||t[61]!==S.target?($e=function(){v.phase===`verdict`&&E(u(S.target),!0,v.resolution.kind)},t[58]=v.phase,t[59]=v.resolution,t[60]=E,t[61]=S.target,t[62]=$e):$e=t[62];let et=$e,tt;t[63]!==v.phase||t[64]!==v.resolution||t[65]!==E?(tt=function(){v.phase===`verdict`&&v.resolution.kind===`renamed`&&E(v.resolution.renamedTo,!0,v.resolution.kind)},t[63]=v.phase,t[64]=v.resolution,t[65]=E,t[66]=tt):tt=t[66];let nt=tt,rt;t[67]!==v.phase||t[68]!==v.resolution||t[69]!==E||t[70]!==S.target?(rt=function(){v.phase===`verdict`&&E(u(S.target),!1,v.resolution.kind)},t[67]=v.phase,t[68]=v.resolution,t[69]=E,t[70]=S.target,t[71]=rt):rt=t[71];let it=rt,at;t[72]!==g||t[73]!==n.project||t[74]!==C||t[75]!==S.target||t[76]!==T||t[77]!==m||t[78]!==x?(at=function(){console.log(f({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:C,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(g({id:`b5aNbi`,values:{targetNoun:x}}))}),m.dismiss()},t[72]=g,t[73]=n.project,t[74]=C,t[75]=S.target,t[76]=T,t[77]=m,t[78]=x,t[79]=at):at=t[79];let ot=at,st;t[80]!==g||t[81]!==T?(st=function(e,t){switch(e){case`helper-not-found`:{let e=t??g({id:`cHhH3i`});l.error(g({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:l.error(g({id:`NJyQi_`,values:{shareBranch:T}}));return;case`fetch-failed`:l.error(g({id:`bWLmRK`}));return;case`already-checked-out`:l.error(g({id:`ljHjfg`}));return;case`branch-exists`:l.error(g({id:`h3QZcB`,values:{shareBranch:T}}));return;case`path-exists`:l.error(g({id:`cN1Gcp`,values:{shareBranch:T}}));return;case`no-git`:l.error(g({id:`CFnavk`}));return;case`invalid-branch`:l.error(g({id:`JfPuv7`,values:{shareBranch:T}}));return;case`proxy-null`:case`error`:l.error(g({id:`e8zYa8`,values:{shareBranch:T}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=g,t[81]=T,t[82]=st):st=t[82];let ct=st,lt;t[83]!==g||t[84]!==n.project||t[85]!==S.target||t[86]!==T||t[87]!==ct||t[88]!==m?(lt=function(e){let t=null,r,i=!1,a=null;if(y(n=>{let{state:o,sideEffect:ee}=Ce(n,e);return ee&&(t=ee.reason,r=ee.helper,i=o.phase===`dismissed`),o.phase===`opening-worktree`&&(a=o.path),o}),t!==null&&(console.log(f({branch_dialog_action:`open-worktree-failed:${t}`,branch:T})),ct(t,r)),a!==null){d();let e=a;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}i&&m.dismiss()},t[83]=g,t[84]=n.project,t[85]=S.target,t[86]=T,t[87]=ct,t[88]=m,t[89]=lt):lt=t[89];let ut=lt,dt;t[90]!==ut||t[91]!==v.phase||t[92]!==n.worktree||t[93]!==T?(dt=function(){v.phase===`ready`&&(console.log(f({branch_dialog_action:`open-worktree`,branch:T})),y(ve),n.worktree.checkout({branch:T}).then(e=>{ut(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ut(null)}))},t[90]=ut,t[91]=v.phase,t[92]=n.worktree,t[93]=T,t[94]=dt):dt=t[94];let ft=dt,pt;t[95]!==g||t[96]!==v.otherWorktreePath||t[97]!==v.phase||t[98]!==n.project||t[99]!==S.target||t[100]!==T||t[101]!==m?(pt=function(){if(v.phase!==`branch-in-other-worktree`)return;let e=v.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.target.kind,path:u(S.target)},pendingBranch:T}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(g({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=g,t[96]=v.otherWorktreePath,t[97]=v.phase,t[98]=n.project,t[99]=S.target,t[100]=T,t[101]=m,t[102]=pt):pt=t[102];let mt=pt,ht;t[103]!==v.phase||t[104]!==v.resolution||t[105]!==m?(ht=function(){console.log(f({branch_dialog_action:`cancel`,verdict_cell:v.phase===`verdict`?v.resolution.kind:void 0})),m.dismiss()},t[103]=v.phase,t[104]=v.resolution,t[105]=m,t[106]=ht):ht=t[106];let D=ht,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K;if(t[107]!==g||t[108]!==v.info||t[109]!==v.otherWorktreePath||t[110]!==v.phase||t[111]!==v.resolution||t[112]!==D||t[113]!==w||t[114]!==S.branch||t[115]!==S.owner||t[116]!==S.repo||t[117]!==S.target||t[118]!==T||t[119]!==x){G=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?pe(v.info):null;let e;t[139]!==v.info||t[140]!==v.phase||t[141]!==w?(e=v.phase===`ready`||v.phase===`switching`||v.phase===`creating-worktree`?me(v.info):w??`HEAD`,t[139]=v.info,t[140]=v.phase,t[141]=w,t[142]=e):e=t[142];let n=e;P=v.phase===`switching`||v.phase===`awaiting-cc1-recycle`,j=v.phase===`creating-worktree`;let r;t[143]===g?r=t[144]:(r=g({id:`OuY8t9`}),t[143]=g,t[144]=r),M=r;let a;t[145]===g?a=t[146]:(a=g({id:`XZkdtg`}),t[145]=g,t[146]=a),N=a;let o;t[147]===g?o=t[148]:(o=g({id:`VTulZj`}),t[147]=g,t[148]=o),K=o;let ie=v.phase===`loading`,se=v.phase===`error`;A=oe,U=!0,t[149]===D?W=t[150]:(W=e=>{e||D()},t[149]=D,t[150]=W),k=ne,R=`sm:max-w-xl`,z=`share-branch-switch-dialog`,B=De,V=Ee;let s;t[151]===x?s=t[152]:(s=(0,h.jsx)(te,{children:(0,h.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:x}})}),t[151]=x,t[152]=s);let ce=S.owner,le=S.repo,l;t[153]===S.target?l=t[154]:(l=u(S.target),t[153]=S.target,t[154]=l);let d;t[155]!==S.owner||t[156]!==S.repo||t[157]!==l?(d=(0,h.jsx)(ee,{className:`sr-only`,children:(0,h.jsx)(i,{id:`f8jU-L`,values:{0:ce,1:le,2:l}})}),t[155]=S.owner,t[156]=S.repo,t[157]=l,t[158]=d):d=t[158],t[159]!==s||t[160]!==d?(H=(0,h.jsxs)(ae,{children:[s,d]}),t[159]=s,t[160]=d,t[161]=H):H=t[161],O=re;let f=S.owner,ue=S.repo,p;t[162]===S.target?p=t[163]:(p=u(S.target),t[162]=S.target,t[163]=p),t[164]!==S.branch||t[165]!==S.owner||t[166]!==S.repo||t[167]!==S.target.kind||t[168]!==p?(F=(0,h.jsx)(`div`,{className:`mb-4`,children:(0,h.jsx)(de,{owner:f,repo:ue,path:p,kind:S.target.kind,branch:S.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=S.branch,t[165]=S.owner,t[166]=S.repo,t[167]=S.target.kind,t[168]=p,t[169]=F):F=t[169],I=v.phase===`branch-in-other-worktree`?(0,h.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,h.jsx)(`p`,{className:`leading-6`,children:(0,h.jsx)(i,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,h.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:v.otherWorktreePath})]}):v.phase===`verdict-pending`?(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`c8jBgX`})]}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,h.jsx)(i,{id:`Uay5NL`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`renamed`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,h.jsx)(i,{id:`P0HC30`,values:{0:v.resolution.renamedTo,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):v.resolution.kind===`diverged`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,h.jsx)(i,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:x},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`c8jBgX`})]}):ie?(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`jerqF0`})]}):se?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,h.jsx)(i,{id:`w4hMYl`})}):G?.kind===`D`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`DTI-fp`,values:{targetNoun:x,shareBranch:T},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`sZ2IOu`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,h.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,h.jsx)(i,{id:`_902BE`,values:{targetNoun:x,shareBranch:T,currentLabel:n},components:{0:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,h.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,h.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,h.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,h.jsx)(i,{id:`n2lRue`})}),(0,h.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:G.conflictingFiles.map(Te)})]}):null,t[107]=g,t[108]=v.info,t[109]=v.otherWorktreePath,t[110]=v.phase,t[111]=v.resolution,t[112]=D,t[113]=w,t[114]=S.branch,t[115]=S.owner,t[116]=S.repo,t[117]=S.target,t[118]=T,t[119]=x,t[120]=O,t[121]=k,t[122]=A,t[123]=j,t[124]=M,t[125]=N,t[126]=P,t[127]=F,t[128]=I,t[129]=L,t[130]=R,t[131]=z,t[132]=B,t[133]=V,t[134]=H,t[135]=U,t[136]=W,t[137]=G,t[138]=K}else O=t[120],k=t[121],A=t[122],j=t[123],M=t[124],N=t[125],P=t[126],F=t[127],I=t[128],L=t[129],R=t[130],z=t[131],B=t[132],V=t[133],H=t[134],U=t[135],W=t[136],G=t[137],K=t[138];let q;t[170]===P?q=t[171]:(q=P?(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,h.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,h.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,h.jsx)(i,{id:`PZtgO0`})]}):null,t[172]=j,t[173]=J);let Y;t[174]!==O||t[175]!==F||t[176]!==I||t[177]!==L||t[178]!==q||t[179]!==J?(Y=(0,h.jsxs)(O,{children:[F,I,L,q,J]}),t[174]=O,t[175]=F,t[176]=I,t[177]=L,t[178]=q,t[179]=J,t[180]=Y):Y=t[180];let gt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,h.jsx)(i,{id:`dEgA5A`}),t[181]=gt):gt=t[181];let X;t[182]===D?X=t[183]:(X=(0,h.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:gt}),t[182]=D,t[183]=X);let Z;t[184]!==v.phase||t[185]!==v.resolution||t[186]!==j||t[187]!==ot||t[188]!==nt||t[189]!==ft||t[190]!==mt||t[191]!==it||t[192]!==Qe||t[193]!==et||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=v.phase===`branch-in-other-worktree`?(0,h.jsx)(o,{onClick:mt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,h.jsx)(i,{id:`hyCxJY`})}):v.phase===`verdict`?v.resolution.kind===`on-origin`?(0,h.jsxs)(o,{onClick:et,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(i,{id:`uA_jXp`})]}):v.resolution.kind===`renamed`?(0,h.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,h.jsx)(i,{id:`AItsE5`})]}):v.resolution.kind===`diverged`?(0,h.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,h.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:[G?.openCurrentEnabled?(0,h.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ot,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,h.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,h.jsx)(o,{variant:`outline`,onClick:Qe,disabled:!G?.switchEnabled||P||j,"aria-disabled":!G?.switchEnabled||P||j,"aria-describedby":G&&!G.switchEnabled&&G.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:P?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),N]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,h.jsx)(o,{onClick:ft,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),K]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=v.phase,t[185]=v.resolution,t[186]=j,t[187]=ot,t[188]=nt,t[189]=ft,t[190]=mt,t[191]=it,t[192]=Qe,t[193]=et,t[194]=M,t[195]=N,t[196]=P,t[197]=G,t[198]=K,t[199]=Z):Z=t[199];let Q;t[200]!==X||t[201]!==Z?(Q=(0,h.jsxs)(ie,{className:`sm:justify-between`,children:[X,Z]}),t[200]=X,t[201]=Z,t[202]=Q):Q=t[202];let $;t[203]!==k||t[204]!==R||t[205]!==z||t[206]!==B||t[207]!==V||t[208]!==H||t[209]!==Y||t[210]!==Q?($=(0,h.jsxs)(k,{className:R,"data-testid":z,onInteractOutside:B,onPointerDownOutside:V,children:[H,Y,Q]}),t[203]=k,t[204]=R,t[205]=z,t[206]=B,t[207]=V,t[208]=H,t[209]=Y,t[210]=Q,t[211]=$):$=t[211];let _t;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(_t=(0,h.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=_t):_t=t[216],_t}function Te(e){return(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(e){return Se(e,null).state}function ke(e){return xe(e,null)}function Ae(e){return ge(e,null)}function je(){return null}export{g as ShareBranchSwitchDialog};
@@ -1 +1 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{n as i,r as a}from"./dist-UKzQrqGt.js";import{n as o}from"./createLucideIcon-DkO1lL_8.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-DFGKErvF.js";import{Qt as u,en as d}from"./dist-CurDB4OA.js";import{t as ie}from"./loader-circle-CLDbHvUo.js";import{n as f}from"./dist-DyPw7rC6.js";import{t as p}from"./desktop-bridge-types-_D7JSBL8.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-DL3XQSe9.js";import{t as se}from"./share-metadata-rows-z85jCRiH.js";var v=e(t(),1),y=r(),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=n();function E(e){return e!==null&&e.kind===`launcher-consent`}function D(e){return e!==null&&e.kind===`launcher-miss`}function O(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,A),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(k));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=D(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=E(o)?o:null,t[6]=o,t[7]=d);let ie=d??u;if(!ie)return null;let p;return t[8]!==ie||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(p=(0,T.jsx)(j,{payload:ie,bridge:n,cloneController:r,store:a},ee),t[8]=ie,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=p):p=t[13],p}function k(e){return e+1}function A(){return null}function j(e){let t=(0,y.c)(165),{payload:n,bridge:r,cloneController:h,store:_}=e,{_:x}=a(),[w,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(null),[j,fe]=(0,v.useState)(!1),[N,pe]=(0,v.useState)(!1),[P,me]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),he=(0,v.useRef)(!1),ge=(0,v.useRef)(null),_e,ve;t[0]===P?(_e=t[1],ve=t[2]):(_e=()=>{P&&ge.current?.focus()},ve=[P],t[0]=P,t[1]=_e,t[2]=ve),(0,v.useEffect)(_e,ve);let ye;t[3]!==F||t[4]!==n?(ye=()=>{E(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,parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=ye):ye=t[5];let be;t[6]===n?be=t[7]:(be=[n],t[6]=n,t[7]=be),(0,v.useEffect)(ye,be);let xe;t[8]!==k||t[9]!==h||t[10]!==n?(xe=()=>{h&&D(n)&&k===null&&(he.current||(he.current=!0,fe(!0),h.getAuthStatus().then(e=>{A(e)}).catch(e=>{console.warn(`[receive] auth pre-flight probe failed`,e instanceof Error?e.message:e),A({authenticated:!1,host:`github.com`})}).finally(()=>{fe(!1)})))},t[8]=k,t[9]=h,t[10]=n,t[11]=xe):xe=t[11];let Se;t[12]!==k||t[13]!==n?(Se=[n,k],t[12]=k,t[13]=n,t[14]=Se):Se=t[14],(0,v.useEffect)(xe,Se);let L=D(n)?n:null,Ce=E(n)?n:null,R=L?.share??Ce?.share??null,z,B,V,H,U,we,W,G;if(t[15]!==x||t[16]!==j||t[17]!==r||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){W=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{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],G=n,V=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:()=>{r.navigator.open()}},duration:8e3});return}if(N)return;me(null),pe(!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),pe(!1),me({detail:t instanceof Error?t.message:String(t)});return}if(pe(!1),n.kind===`error`){me({detail:n.detail??null});return}if(n.kind===`ok`){try{await r.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}),_.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 a;t[36]!==x||t[37]!==j||t[38]!==h?(a=async function(){if(!(!h||j)){fe(!0);try{let e=await h.startSignIn();fe(!1),e!==null&&A(e)}catch(e){let t=e;fe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=j,t[38]=h,t[39]=a):a=t[39],U=a,H=async function(){if(!(!L||!e||w)){me(null),O(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await r.dialog.openFolder();if(!t)break;let n=await r.share.validateLocalFolder({folderPath:t,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 r.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let i=d(e,n)!==`true`;try{await r.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...i?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}}),_.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 i=g(n,e);i&&f.error(i)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}O(!1)}};let m;t[40]!==x||t[41]!==r||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(de),r.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 r.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),I(ue),_.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,i=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:i})),f.error(i)}).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]=r,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(M),_.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`,r;t[48]===b?r=t[49]:(r=e=>{e||b()},t[48]=b,t[49]=r);let a;t[50]===G?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:G}})}),t[50]=G,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)(i,{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)(i,{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)(i,{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)(i,{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)(i,{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 animate-spin`,"aria-hidden":`true`}),(0,T.jsx)(i,{id:`NKkZXl`})]}):(0,T.jsx)(i,{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]!==r||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:r,children:M}),t[100]=r,t[101]=M,t[102]=ue):ue=t[102],W=ue;break bb0}if(!L||!R||!e){W=null;break bb0}z=h!==void 0&&!N;let E;t[103]!==x||t[104]!==N?(E=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=E):E=t[105],B=E,we=u(e)}t[15]=x,t[16]=j,t[17]=r,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]=B,t[27]=V,t[28]=H,t[29]=U,t[30]=we,t[31]=W,t[32]=G}else z=t[25],B=t[26],V=t[27],H=t[28],U=t[29],we=t[30],W=t[31],G=t[32];if(W!==Symbol.for(`react.early_return_sentinel`))return W;let Te=we,Ee=k?.authenticated?k.login:void 0,De;t[106]===P?De=t[107]:(De=P?.detail?m(P.detail):``,t[106]=P,t[107]=De);let Oe=De,K;t[108]===_?K=t[109]:(K=e=>{e||_.dismiss()},t[108]=_,t[109]=K);let q;t[110]===G?q=t[111]:(q=(0,T.jsx)(te,{children:(0,T.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:G}})}),t[110]=G,t[111]=q);let J;t[112]===R.target?J=t[113]:(J=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=J);let Y;t[114]!==R.owner||t[115]!==R.repo||t[116]!==J?(Y=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,J]}),t[114]=R.owner,t[115]=R.repo,t[116]=J,t[117]=Y):Y=t[117];let ke=R.owner,Ae=R.repo,X;t[118]===R.target?X=t[119]:(X=p(R.target),t[118]=R.target,t[119]=X);let Z;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==X?(Z=(0,T.jsx)(se,{owner:ke,repo:Ae,path:X,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]=X,t[125]=Z):Z=t[125];let Q;t[126]!==q||t[127]!==Y||t[128]!==Z?(Q=(0,T.jsxs)(c,{children:[q,Y,Z]}),t[126]=q,t[127]=Y,t[128]=Z,t[129]=Q):Q=t[129];let $;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Oe||t[134]!==B||t[135]!==N||t[136]!==V||t[137]!==H||t[138]!==w?($=P?(0,T.jsxs)(`div`,{ref:ge,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)(i,{id:`aiArms`})}),Oe?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(i,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Oe,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(i,{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)(i,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(i,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(i,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{V()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(i,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{H()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(i,{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:()=>{V()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:B}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(i,{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:()=>{H()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(i,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(i,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Oe,t[134]=B,t[135]=N,t[136]=V,t[137]=H,t[138]=w,t[139]=$):$=t[139];let je;t[140]!==j||t[141]!==k||t[142]!==h||t[143]!==U||t[144]!==Ee?(je=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:k===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(i,{id:`UDFrWm`})}):k.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(i,{id:`VAHWL_`,values:{signedInLogin:Ee},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)(i,{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:()=>{U()},disabled:j,children:j?(0,T.jsx)(i,{id:`PKLY-1`}):(0,T.jsx)(i,{id:`3jod3l`})})]})}):null,t[140]=j,t[141]=k,t[142]=h,t[143]=U,t[144]=Ee,t[145]=je):je=t[145];let Me;t[146]!==P||t[147]!==Te?(Me=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(i,{id:`RJ3a8Z`,values:{lookingForUrl:Te},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=Te,t[148]=Me):Me=t[148];let Ne;t[149]!==$||t[150]!==je||t[151]!==Me?(Ne=(0,T.jsxs)(re,{children:[$,je,Me]}),t[149]=$,t[150]=je,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===_?Pe=t[154]:(Pe=()=>_.dismiss(),t[153]=_,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,T.jsx)(i,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Q||t[159]!==Ne||t[160]!==Ie?(Le=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Q,Ne,Ie]}),t[158]=Q,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==K||t[163]!==Le?(Re=(0,T.jsx)(l,{open:!0,onOpenChange:K,children:Le}),t[162]=K,t[163]=Le,t[164]=Re):Re=t[164],Re}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function M(e){return e===null?e:w(e)}function ue(e){return e===null?e:C(e,{ok:!0})}function de(e){return e===null?e:x(e)}export{O as ShareReceiveDialog};
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{n as i,r as a}from"./dist-UKzQrqGt.js";import{n as o}from"./createLucideIcon-DkO1lL_8.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-DFGKErvF.js";import{Qt as u,en as d}from"./dist-DkRtDyLN.js";import{t as ie}from"./loader-circle-CLDbHvUo.js";import{n as f}from"./dist-DyPw7rC6.js";import{t as p}from"./desktop-bridge-types-_D7JSBL8.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-DYDEnyEg.js";import{t as se}from"./share-metadata-rows-z85jCRiH.js";var v=e(t(),1),y=r(),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=n();function E(e){return e!==null&&e.kind===`launcher-consent`}function D(e){return e!==null&&e.kind===`launcher-miss`}function O(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,A),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(k));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=D(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=E(o)?o:null,t[6]=o,t[7]=d);let ie=d??u;if(!ie)return null;let p;return t[8]!==ie||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(p=(0,T.jsx)(j,{payload:ie,bridge:n,cloneController:r,store:a},ee),t[8]=ie,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=p):p=t[13],p}function k(e){return e+1}function A(){return null}function j(e){let t=(0,y.c)(165),{payload:n,bridge:r,cloneController:h,store:_}=e,{_:x}=a(),[w,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(null),[j,fe]=(0,v.useState)(!1),[N,pe]=(0,v.useState)(!1),[P,me]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),he=(0,v.useRef)(!1),ge=(0,v.useRef)(null),_e,ve;t[0]===P?(_e=t[1],ve=t[2]):(_e=()=>{P&&ge.current?.focus()},ve=[P],t[0]=P,t[1]=_e,t[2]=ve),(0,v.useEffect)(_e,ve);let ye;t[3]!==F||t[4]!==n?(ye=()=>{E(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,parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=ye):ye=t[5];let be;t[6]===n?be=t[7]:(be=[n],t[6]=n,t[7]=be),(0,v.useEffect)(ye,be);let xe;t[8]!==k||t[9]!==h||t[10]!==n?(xe=()=>{h&&D(n)&&k===null&&(he.current||(he.current=!0,fe(!0),h.getAuthStatus().then(e=>{A(e)}).catch(e=>{console.warn(`[receive] auth pre-flight probe failed`,e instanceof Error?e.message:e),A({authenticated:!1,host:`github.com`})}).finally(()=>{fe(!1)})))},t[8]=k,t[9]=h,t[10]=n,t[11]=xe):xe=t[11];let Se;t[12]!==k||t[13]!==n?(Se=[n,k],t[12]=k,t[13]=n,t[14]=Se):Se=t[14],(0,v.useEffect)(xe,Se);let L=D(n)?n:null,Ce=E(n)?n:null,R=L?.share??Ce?.share??null,z,B,V,H,U,we,W,G;if(t[15]!==x||t[16]!==j||t[17]!==r||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){W=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{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],G=n,V=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:()=>{r.navigator.open()}},duration:8e3});return}if(N)return;me(null),pe(!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),pe(!1),me({detail:t instanceof Error?t.message:String(t)});return}if(pe(!1),n.kind===`error`){me({detail:n.detail??null});return}if(n.kind===`ok`){try{await r.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}),_.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 a;t[36]!==x||t[37]!==j||t[38]!==h?(a=async function(){if(!(!h||j)){fe(!0);try{let e=await h.startSignIn();fe(!1),e!==null&&A(e)}catch(e){let t=e;fe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=j,t[38]=h,t[39]=a):a=t[39],U=a,H=async function(){if(!(!L||!e||w)){me(null),O(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await r.dialog.openFolder();if(!t)break;let n=await r.share.validateLocalFolder({folderPath:t,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 r.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let i=d(e,n)!==`true`;try{await r.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...i?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}}),_.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 i=g(n,e);i&&f.error(i)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}O(!1)}};let m;t[40]!==x||t[41]!==r||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(de),r.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 r.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),I(ue),_.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,i=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:i})),f.error(i)}).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]=r,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(M),_.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`,r;t[48]===b?r=t[49]:(r=e=>{e||b()},t[48]=b,t[49]=r);let a;t[50]===G?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:G}})}),t[50]=G,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)(i,{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)(i,{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)(i,{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)(i,{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)(i,{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 animate-spin`,"aria-hidden":`true`}),(0,T.jsx)(i,{id:`NKkZXl`})]}):(0,T.jsx)(i,{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]!==r||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:r,children:M}),t[100]=r,t[101]=M,t[102]=ue):ue=t[102],W=ue;break bb0}if(!L||!R||!e){W=null;break bb0}z=h!==void 0&&!N;let E;t[103]!==x||t[104]!==N?(E=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=E):E=t[105],B=E,we=u(e)}t[15]=x,t[16]=j,t[17]=r,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]=B,t[27]=V,t[28]=H,t[29]=U,t[30]=we,t[31]=W,t[32]=G}else z=t[25],B=t[26],V=t[27],H=t[28],U=t[29],we=t[30],W=t[31],G=t[32];if(W!==Symbol.for(`react.early_return_sentinel`))return W;let Te=we,Ee=k?.authenticated?k.login:void 0,De;t[106]===P?De=t[107]:(De=P?.detail?m(P.detail):``,t[106]=P,t[107]=De);let Oe=De,K;t[108]===_?K=t[109]:(K=e=>{e||_.dismiss()},t[108]=_,t[109]=K);let q;t[110]===G?q=t[111]:(q=(0,T.jsx)(te,{children:(0,T.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:G}})}),t[110]=G,t[111]=q);let J;t[112]===R.target?J=t[113]:(J=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=J);let Y;t[114]!==R.owner||t[115]!==R.repo||t[116]!==J?(Y=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,J]}),t[114]=R.owner,t[115]=R.repo,t[116]=J,t[117]=Y):Y=t[117];let ke=R.owner,Ae=R.repo,X;t[118]===R.target?X=t[119]:(X=p(R.target),t[118]=R.target,t[119]=X);let Z;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==X?(Z=(0,T.jsx)(se,{owner:ke,repo:Ae,path:X,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]=X,t[125]=Z):Z=t[125];let Q;t[126]!==q||t[127]!==Y||t[128]!==Z?(Q=(0,T.jsxs)(c,{children:[q,Y,Z]}),t[126]=q,t[127]=Y,t[128]=Z,t[129]=Q):Q=t[129];let $;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Oe||t[134]!==B||t[135]!==N||t[136]!==V||t[137]!==H||t[138]!==w?($=P?(0,T.jsxs)(`div`,{ref:ge,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)(i,{id:`aiArms`})}),Oe?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(i,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Oe,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(i,{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)(i,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(i,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(i,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{V()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(i,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{H()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(i,{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:()=>{V()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:B}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(i,{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:()=>{H()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(i,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(i,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Oe,t[134]=B,t[135]=N,t[136]=V,t[137]=H,t[138]=w,t[139]=$):$=t[139];let je;t[140]!==j||t[141]!==k||t[142]!==h||t[143]!==U||t[144]!==Ee?(je=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:k===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(i,{id:`UDFrWm`})}):k.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(i,{id:`VAHWL_`,values:{signedInLogin:Ee},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)(i,{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:()=>{U()},disabled:j,children:j?(0,T.jsx)(i,{id:`PKLY-1`}):(0,T.jsx)(i,{id:`3jod3l`})})]})}):null,t[140]=j,t[141]=k,t[142]=h,t[143]=U,t[144]=Ee,t[145]=je):je=t[145];let Me;t[146]!==P||t[147]!==Te?(Me=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(i,{id:`RJ3a8Z`,values:{lookingForUrl:Te},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=Te,t[148]=Me):Me=t[148];let Ne;t[149]!==$||t[150]!==je||t[151]!==Me?(Ne=(0,T.jsxs)(re,{children:[$,je,Me]}),t[149]=$,t[150]=je,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===_?Pe=t[154]:(Pe=()=>_.dismiss(),t[153]=_,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,T.jsx)(i,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Q||t[159]!==Ne||t[160]!==Ie?(Le=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Q,Ne,Ie]}),t[158]=Q,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==K||t[163]!==Le?(Re=(0,T.jsx)(l,{open:!0,onOpenChange:K,children:Le}),t[162]=K,t[163]=Le,t[164]=Re):Re=t[164],Re}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function M(e){return e===null?e:w(e)}function ue(e){return e===null?e:C(e,{ok:!0})}function de(e){return e===null?e:x(e)}export{O as ShareReceiveDialog};
@@ -1 +1 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-DFGKErvF.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-BqFe0QyH.js";import{t as p}from"./miss-dialog-store-CyOCdXFw.js";import{c as m,s as h}from"./doc-hash-CZiGDoto.js";var g=r(),_=e(t(),1),v=n();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(p.subscribe,p.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(25),{nav:n}=e,{state:r,refetch:_}=l(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){p.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=m(u(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){d.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?m(e):h(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(s,{children:(0,v.jsx)(i,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=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`,M;t[11]!==C||t[12]!==n||t[13]!==T||t[14]!==_||t[15]!==r?(M=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_}),t[11]=C,t[12]=n,t[13]=T,t[14]=_,t[15]=r,t[16]=M):M=t[16];let N;t[17]!==M||t[18]!==j?(N=(0,v.jsx)(o,{className:j,children:M}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;return t[20]!==r.phase||t[21]!==N||t[22]!==O||t[23]!==A?(P=(0,v.jsx)(c,{open:!0,onOpenChange:E,children:(0,v.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,N]})}),t[20]=r.phase,t[21]=N,t[22]=O,t[23]=A,t[24]=P):P=t[24],P}export{b as ShareReceiveMissDialog};
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-DFGKErvF.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-BUhyCKTL.js";import{t as p}from"./miss-dialog-store-CyOCdXFw.js";import{c as m,s as h}from"./doc-hash-BDRwCcvB.js";var g=r(),_=e(t(),1),v=n();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(p.subscribe,p.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(25),{nav:n}=e,{state:r,refetch:_}=l(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){p.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=m(u(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){d.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?m(e):h(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(s,{children:(0,v.jsx)(i,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=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`,M;t[11]!==C||t[12]!==n||t[13]!==T||t[14]!==_||t[15]!==r?(M=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_}),t[11]=C,t[12]=n,t[13]=T,t[14]=_,t[15]=r,t[16]=M):M=t[16];let N;t[17]!==M||t[18]!==j?(N=(0,v.jsx)(o,{className:j,children:M}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;return t[20]!==r.phase||t[21]!==N||t[22]!==O||t[23]!==A?(P=(0,v.jsx)(c,{open:!0,onOpenChange:E,children:(0,v.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,N]})}),t[20]=r.phase,t[21]=N,t[22]=O,t[23]=A,t[24]=P):P=t[24],P}export{b as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{n as i}from"./dist-UKzQrqGt.js";import{n as ee,u as te}from"./createLucideIcon-DkO1lL_8.js";import{E as ne,S as a,_ as o,h as s,m as c,p as re,v as ie}from"./skills-api-ChqmqNEn.js";import{N as l,kt as u}from"./dist-CurDB4OA.js";import{t as d}from"./chevron-down-CfwFDIcB.js";import{i as ae,r as oe}from"./skill-actions-CqFXEGI_.js";var se=r(),f=e(t(),1),p=n(),m=u.options;function h(e){let t=(0,se.c)(74),{scope:n,name:r}=e,u=ae(),h=oe(),g;t[0]!==r||t[1]!==n||t[2]!==u.data||t[3]!==u.status?(g=u.status===`ready`?u.data.find(e=>e.scope===n&&e.name===r):void 0,t[0]=r,t[1]=n,t[2]=u.data,t[3]=u.status,t[4]=g):g=t[4];let _=g,v;t[5]!==_||t[6]!==r||t[7]!==n?(v=_??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[5]=_,t[6]=r,t[7]=n,t[8]=v):v=t[8];let y=v,b=h.installingName===r,[x,S]=(0,f.useState)(null),C=x??y.hosts,w;t[9]===C?w=t[10]:(w=new Set(C),t[9]=C,t[10]=w);let T=w,E=x?x.length>0:y.installed,D=(0,f.useRef)(y.hosts),O,k;t[11]!==x||t[12]!==y.hosts?(O=()=>{x===null&&(D.current=y.hosts)},k=[x,y.hosts],t[11]=x,t[12]=y.hosts,t[13]=O,t[14]=k):(O=t[13],k=t[14]),(0,f.useEffect)(O,k);let A;t[15]===y.hosts?A=t[16]:(A=[...y.hosts].sort().join(`,`),t[15]=y.hosts,t[16]=A);let j=A,M,N;t[17]===j?(M=t[18],N=t[19]):(M=()=>{S(e=>e&&[...e].sort().join(`,`)===j?null:e)},N=[j],t[17]=j,t[18]=M,t[19]=N),(0,f.useEffect)(M,N);let P=(0,f.useRef)(null),F,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current)},F=[],t[20]=F,t[21]=I):(F=t[20],I=t[21]),(0,f.useEffect)(I,F);let L,R,z,B,V,H,U,W,G;if(t[22]!==h||t[23]!==T||t[24]!==E||t[25]!==b||t[26]!==y){z=function(e,t){D.current=e,S(e),P.current&&clearTimeout(P.current);let n=async()=>{(await h.install(y,e)).ok||S(null)};t?P.current=setTimeout(()=>void n(),350):n()};let e=function(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)};G=`flex items-center gap-1.5`,R=re;let n=E?`installed`:`draft`,r=E?`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary`:`border-yellow-500/40 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20 hover:text-yellow-600`,a;t[36]===r?a=t[37]:(a=te(`h-6 gap-1 rounded-sm border px-1.5 font-mono text-xs uppercase shadow-none`,r),t[36]=r,t[37]=a);let o;t[38]!==E||t[39]!==b?(o=b?(0,p.jsx)(i,{id:`b4itZn`}):E?(0,p.jsx)(i,{id:`eQkgKV`}):(0,p.jsx)(i,{id:`eneWvv`}),t[38]=E,t[39]=b,t[40]=o):o=t[40];let u;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,p.jsx)(d,{"aria-hidden":!0}),t[41]=u):u=t[41],t[42]!==b||t[43]!==n||t[44]!==a||t[45]!==o?(W=(0,p.jsx)(ne,{asChild:!0,children:(0,p.jsxs)(ee,{variant:`outline`,size:`sm`,disabled:b,"data-testid":`skill-install-menu-trigger`,"data-state":n,className:a,children:[o,u]})}),t[42]=b,t[43]=n,t[44]=a,t[45]=o,t[46]=W):W=t[46],L=s,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(ie,{children:(0,p.jsx)(i,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(c,{checked:T.has(t),onCheckedChange:n=>e(t,n===!0),"data-testid":`skill-install-editor-${t}`,children:l[t]},t)),t[22]=h,t[23]=T,t[24]=E,t[25]=b,t[26]=y,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=U,t[34]=W,t[35]=G}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],U=t[33],W=t[34],G=t[35];let K;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,p.jsx)(a,{}),t[48]=K):K=t[48];let q;t[49]===z?q=t[50]:(q=()=>z([...m],!1),t[49]=z,t[50]=q);let J;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,p.jsx)(i,{id:`x-5mJ1`}),t[51]=J):J=t[51];let Y;t[52]===q?Y=t[53]:(Y=(0,p.jsx)(o,{"data-testid":`skill-install-all`,onSelect:q,children:J}),t[52]=q,t[53]=Y);let X;t[54]!==h||t[55]!==E||t[56]!==y?(X=E?(0,p.jsx)(o,{"data-testid":`skill-uninstall`,onSelect:()=>{P.current&&clearTimeout(P.current),D.current=[],S([]),(async()=>{(await h.uninstall(y)).ok||S(null)})()},children:(0,p.jsx)(i,{id:`t422_7`})}):null,t[54]=h,t[55]=E,t[56]=y,t[57]=X):X=t[57];let Z;t[58]!==L||t[59]!==B||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==Y||t[64]!==X?(Z=(0,p.jsxs)(L,{align:B,className:V,children:[H,U,K,Y,X]}),t[58]=L,t[59]=B,t[60]=V,t[61]=H,t[62]=U,t[63]=Y,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==R||t[67]!==W||t[68]!==Z?(Q=(0,p.jsxs)(R,{children:[W,Z]}),t[66]=R,t[67]=W,t[68]=Z,t[69]=Q):Q=t[69];let $;return t[70]!==h.dialogs||t[71]!==G||t[72]!==Q?($=(0,p.jsxs)(`div`,{className:G,children:[Q,h.dialogs]}),t[70]=h.dialogs,t[71]=G,t[72]=Q,t[73]=$):$=t[73],$}export{h as SkillEditorActions};
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{n as i}from"./dist-UKzQrqGt.js";import{n as ee,u as te}from"./createLucideIcon-DkO1lL_8.js";import{E as ne,S as a,_ as o,h as s,m as c,p as re,v as ie}from"./skills-api-UJqRM51N.js";import{N as l,kt as u}from"./dist-DkRtDyLN.js";import{t as d}from"./chevron-down-CfwFDIcB.js";import{i as ae,r as oe}from"./skill-actions-32qU2dgG.js";var se=r(),f=e(t(),1),p=n(),m=u.options;function h(e){let t=(0,se.c)(74),{scope:n,name:r}=e,u=ae(),h=oe(),g;t[0]!==r||t[1]!==n||t[2]!==u.data||t[3]!==u.status?(g=u.status===`ready`?u.data.find(e=>e.scope===n&&e.name===r):void 0,t[0]=r,t[1]=n,t[2]=u.data,t[3]=u.status,t[4]=g):g=t[4];let _=g,v;t[5]!==_||t[6]!==r||t[7]!==n?(v=_??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[5]=_,t[6]=r,t[7]=n,t[8]=v):v=t[8];let y=v,b=h.installingName===r,[x,S]=(0,f.useState)(null),C=x??y.hosts,w;t[9]===C?w=t[10]:(w=new Set(C),t[9]=C,t[10]=w);let T=w,E=x?x.length>0:y.installed,D=(0,f.useRef)(y.hosts),O,k;t[11]!==x||t[12]!==y.hosts?(O=()=>{x===null&&(D.current=y.hosts)},k=[x,y.hosts],t[11]=x,t[12]=y.hosts,t[13]=O,t[14]=k):(O=t[13],k=t[14]),(0,f.useEffect)(O,k);let A;t[15]===y.hosts?A=t[16]:(A=[...y.hosts].sort().join(`,`),t[15]=y.hosts,t[16]=A);let j=A,M,N;t[17]===j?(M=t[18],N=t[19]):(M=()=>{S(e=>e&&[...e].sort().join(`,`)===j?null:e)},N=[j],t[17]=j,t[18]=M,t[19]=N),(0,f.useEffect)(M,N);let P=(0,f.useRef)(null),F,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current)},F=[],t[20]=F,t[21]=I):(F=t[20],I=t[21]),(0,f.useEffect)(I,F);let L,R,z,B,V,H,U,W,G;if(t[22]!==h||t[23]!==T||t[24]!==E||t[25]!==b||t[26]!==y){z=function(e,t){D.current=e,S(e),P.current&&clearTimeout(P.current);let n=async()=>{(await h.install(y,e)).ok||S(null)};t?P.current=setTimeout(()=>void n(),350):n()};let e=function(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)};G=`flex items-center gap-1.5`,R=re;let n=E?`installed`:`draft`,r=E?`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary`:`border-yellow-500/40 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20 hover:text-yellow-600`,a;t[36]===r?a=t[37]:(a=te(`h-6 gap-1 rounded-sm border px-1.5 font-mono text-xs uppercase shadow-none`,r),t[36]=r,t[37]=a);let o;t[38]!==E||t[39]!==b?(o=b?(0,p.jsx)(i,{id:`b4itZn`}):E?(0,p.jsx)(i,{id:`eQkgKV`}):(0,p.jsx)(i,{id:`eneWvv`}),t[38]=E,t[39]=b,t[40]=o):o=t[40];let u;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,p.jsx)(d,{"aria-hidden":!0}),t[41]=u):u=t[41],t[42]!==b||t[43]!==n||t[44]!==a||t[45]!==o?(W=(0,p.jsx)(ne,{asChild:!0,children:(0,p.jsxs)(ee,{variant:`outline`,size:`sm`,disabled:b,"data-testid":`skill-install-menu-trigger`,"data-state":n,className:a,children:[o,u]})}),t[42]=b,t[43]=n,t[44]=a,t[45]=o,t[46]=W):W=t[46],L=s,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(ie,{children:(0,p.jsx)(i,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(c,{checked:T.has(t),onCheckedChange:n=>e(t,n===!0),"data-testid":`skill-install-editor-${t}`,children:l[t]},t)),t[22]=h,t[23]=T,t[24]=E,t[25]=b,t[26]=y,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=U,t[34]=W,t[35]=G}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],U=t[33],W=t[34],G=t[35];let K;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,p.jsx)(a,{}),t[48]=K):K=t[48];let q;t[49]===z?q=t[50]:(q=()=>z([...m],!1),t[49]=z,t[50]=q);let J;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,p.jsx)(i,{id:`x-5mJ1`}),t[51]=J):J=t[51];let Y;t[52]===q?Y=t[53]:(Y=(0,p.jsx)(o,{"data-testid":`skill-install-all`,onSelect:q,children:J}),t[52]=q,t[53]=Y);let X;t[54]!==h||t[55]!==E||t[56]!==y?(X=E?(0,p.jsx)(o,{"data-testid":`skill-uninstall`,onSelect:()=>{P.current&&clearTimeout(P.current),D.current=[],S([]),(async()=>{(await h.uninstall(y)).ok||S(null)})()},children:(0,p.jsx)(i,{id:`t422_7`})}):null,t[54]=h,t[55]=E,t[56]=y,t[57]=X):X=t[57];let Z;t[58]!==L||t[59]!==B||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==Y||t[64]!==X?(Z=(0,p.jsxs)(L,{align:B,className:V,children:[H,U,K,Y,X]}),t[58]=L,t[59]=B,t[60]=V,t[61]=H,t[62]=U,t[63]=Y,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==R||t[67]!==W||t[68]!==Z?(Q=(0,p.jsxs)(R,{children:[W,Z]}),t[66]=R,t[67]=W,t[68]=Z,t[69]=Q):Q=t[69];let $;return t[70]!==h.dialogs||t[71]!==G||t[72]!==Q?($=(0,p.jsxs)(`div`,{className:G,children:[Q,h.dialogs]}),t[70]=h.dialogs,t[71]=G,t[72]=Q,t[73]=$):$=t[73],$}export{h as SkillEditorActions};
@@ -1 +1 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{B as i,M as a,dt as o,ft as s}from"./DocumentContext-ogFq9Apo.js";import{n as c}from"./dist-DA2I9IQS.js";import{O as l,P as u,a as d,i as f,o as ee}from"./CodeMirrorPropInput-f5pC607I.js";import{I as p,T as te,gn as m,ur as h,xi as ne,zr as g}from"./dist-CurDB4OA.js";import{c as re,f as ie,n as ae,p as oe,r as se,u as ce}from"./typing-burst-detector-ByylQ2W5.js";import{_ as le,a as ue}from"./lint-config-client-VuF6BI2d.js";import"./config-provider-BGFykK9q.js";import{$ as _,Bt as v,Dt as de,Et as y,Ft as b,J as x,Mt as fe,Ot as S,P as C,Pt as w,Q as T,Tt as E,X as D,Z as O,_t as k,at as A,ft as j,jt as M,lt as N,pt as pe,ut as me,vt as P,yt as F}from"./dist-CdtMC9tO.js";import{n as he}from"./config-context-DBmRI7_N.js";import{o as ge,r as _e}from"./selection-context-DRS0xWzo.js";import{n as ve,t as ye}from"./dist-TX_NQU76.js";import{t as be}from"./src-B_OV9KU-.js";var I=e(t(),1),xe=r(),L=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},R=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet($).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new fe,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=Ne(s);if(i)o.add(n,n,x.widget({widget:new Ee(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,x.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,z(f))}};function z(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new L(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new L(r.from,n,r.diagnostic)}),r}function B(e,t){let n=t.pos,r=t.end||n,i=e.state.facet($).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(U))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function V(e,t){return e.field(K,!1)?t:t.concat(w.appendConfig.of(We))}function H(e,t){return{effects:V(e,[U.of(t)])}}var U=w.define(),W=w.define(),G=w.define(),K=b.define({create(){return new R(x.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=z(n,e.selected.diagnostic,i)||z(n,null,i)}!n.size&&i&&t.state.facet($).autoPanel&&(i=null),e=new R(n,i,r)}for(let n of t.effects)if(n.is(U)){let r=t.state.facet($).autoPanel?n.value.length?Oe.open:null:e.panel;e=R.init(n.value,r,t.state)}else n.is(W)?e=new R(e.diagnostics,n.value?Oe.open:null,e.selected):n.is(G)&&(e=new R(e.diagnostics,e.panel,n.value));return e},provide:e=>[k.from(e,e=>e.panel),D.decorations.from(e,e=>e.diagnostics)]}),q=x.mark({class:`cm-lintRange cm-lintRange-active`});function J(e,t,n){let{diagnostics:r}=e.state.field(K),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet($).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:!0,create(){return{dom:Y(e,i)}}}:null}function Y(e,t){return F(`ul`,{class:`cm-tooltip-lint`},t.map(t=>Te(e,t,!1)))}var X=e=>{let t=e.state.field(K,!1);return!t||!t.panel?!1:(e.dispatch({effects:W.of(!1)}),!0)},Z=T.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet($);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet($);t.length&&Q(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(H(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{j(this.view.state,e)})}}update(e){let t=e.state.facet($);(e.docChanged||t!=e.startState.facet($)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function Q(e,t,n){let r=[],i=-1;for(let a of e)a.then(n=>{r.push(n),clearTimeout(i),r.length==e.length?t(r):i=setTimeout(()=>t(r),200)},n)}var $=S.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...v(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Se,tooltipFilter:Se,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function Se(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Ce(e,t={}){return[$.of({source:e,config:t}),Z,We]}function we(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function Te(e,t,n){let r=n?we(t.actions):[];return F(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},F(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=z(e.state.field(K).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),F(`u`,s.slice(c,c+1)),s.slice(c+1)];return F(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&F(`div`,{class:`cm-diagnosticSource`},t.source))}var Ee=class extends _{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return F(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},De=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=Te(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},Oe=class e{constructor(e){this.view=e,this.items=[],this.list=F(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)X(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=we(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=z(this.view.state.field(K).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=F(`div`,{class:`cm-panel-lint`},this.list,F(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>X(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(K).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(K),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new De(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new De(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=z(this.view.state.field(K).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:G.of(t)})}static open(t){return new e(t)}};function ke(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function Ae(e){return ke(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var je=D.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:Ae(`#f11`)},".cm-lintRange-warning":{backgroundImage:Ae(`orange`)},".cm-lintRange-info":{backgroundImage:Ae(`#999`)},".cm-lintRange-hint":{backgroundImage:Ae(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function Me(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function Ne(e){let t=`hint`,n=1;for(let r of e){let e=Me(r.severity);e>n&&(n=e,t=r.severity)}return t}var Pe=class extends O{constructor(e){super(),this.diagnostics=e,this.severity=Ne(e)}toDOM(e){let t=document.createElement(`div`);t.className=`cm-lint-marker cm-lint-marker-`+this.severity;let n=this.diagnostics,r=e.state.facet(Ge).tooltipFilter;return r&&(n=r(n,e.state)),n.length&&(t.onmouseover=()=>Ie(e,t,n)),t}};function Fe(e,t){let n=r=>{let i=t.getBoundingClientRect();if(!(r.clientX>i.left-10&&r.clientX<i.right+10&&r.clientY>i.top-10&&r.clientY<i.bottom+10)){for(let e=r.target;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains(`cm-tooltip-lint`))return;window.removeEventListener(`mousemove`,n),e.state.field(Ve)&&e.dispatch({effects:Be.of(null)})}};window.addEventListener(`mousemove`,n)}function Ie(e,t,n){function r(){let r=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(r.from)&&e.dispatch({effects:Be.of({pos:r.from,above:!1,clip:!1,create(){return{dom:Y(e,n),getCoords:()=>t.getBoundingClientRect()}}})}),t.onmouseout=t.onmousemove=null,Fe(e,t)}let{hoverTime:i}=e.state.facet(Ge),a=setTimeout(r,i);t.onmouseout=()=>{clearTimeout(a),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(a),a=setTimeout(r,i)}}function Le(e,t){let n=Object.create(null);for(let r of t){let t=e.lineAt(r.from);(n[t.from]||(n[t.from]=[])).push(r)}let r=[];for(let e in n)r.push(new Pe(n[e]).range(+e));return M.of(r,!0)}var Re=A({class:`cm-gutter-lint`,markers:e=>e.state.field(ze),widgetMarker:(e,t,n)=>{let r=[];return e.state.field(ze).between(n.from,n.to,(e,t,i)=>{e>n.from&&e<n.to&&r.push(...i.diagnostics)}),r.length?new Pe(r):null}}),ze=b.define({create(){return M.empty},update(e,t){e=e.map(t.changes);let n=t.state.facet(Ge).markerFilter;for(let r of t.effects)if(r.is(U)){let i=r.value;n&&(i=n(i||[],t.state)),e=Le(t.state.doc,i.slice(0))}return e}}),Be=w.define(),Ve=b.define({create(){return null},update(e,t){return e&&t.docChanged&&(e=B(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(Be)?t.value:e,e)},provide:e=>P.from(e)}),He=D.baseTheme({".cm-gutter-lint":{width:`1.4em`,"& .cm-gutterElement":{padding:`.2em`}},".cm-lint-marker":{width:`1em`,height:`1em`},".cm-lint-marker-info":{content:ke(`<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>`)},".cm-lint-marker-warning":{content:ke(`<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>`)},".cm-lint-marker-error":{content:ke(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)}}),Ue=N(J,{hideOn:B}),We=[K,D.decorations.compute([K],e=>{let{selected:t,panel:n}=e.field(K);return!t||!n||t.from==t.to?x.none:x.set([q.range(t.from,t.to)])}),Ue,je],Ge=S.define({combine(e){return v(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function Ke(e={}){return[Ge.of(e),ze,Re,He,Ve]}function qe(e,t){return e.enabled?[Ke(),Ce(async n=>Ye(n.state.doc,await h(n.state.doc.toString(),e,t)),{delay:600})]:[]}function Je(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 Ye(e,t){let n=[];for(let r of t){let t=Je(e,r.range.start),i=Je(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=Xe(r);o&&(a.actions=[o]),n.push(a)}return n}function Xe(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:Je(n,e.range.start),to:Je(n,e.range.end),insert:e.newText}))})}}}var Ze=x.mark({class:`cm-link-ref-broken`}),Qe=/^\s{0,3}\[([^\]]+)\]:\s/,$e=/\[([^\]]*)\]\[([^\]]*)\]/g,et=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function tt(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 nt(e){let t=[];return C(e).iterate({enter(e){if(et.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function rt(e){let t=new Set,n=[],r=e.doc,i=nt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(tt(n.from,i))continue;let a=Qe.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!tt(t.from,i)&&!Qe.test(t.text))for($e.lastIndex=0;;){let e=$e.exec(t.text);if(!e)break;let r=t.from+e.index;if(tt(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(Ze.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),x.set(a)}var it=b.define({create(e){return rt(e)},update(e,t){return t.docChanged?rt(t.state):e},provide:e=>D.decorations.from(e)}),at=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,ot=x.mark({class:`cm-del`}),st=x.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),ct=x.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function lt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function ut(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!p.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(p.test(r.text))return{from:t.from,to:r.to}}return null}function dt(e,t){let n=[],r=C(e),i=ut(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(ot.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=at.exec(r.text),a=i?i[1].length:2,o=x.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=lt(r.text),a=x.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(st.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(ct.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(ct.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),x.set(n)}var ft=class{decorations;constructor(e){this.decorations=dt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||C(e.startState)!==C(e.state))&&(this.decorations=dt(e.view.state,e.view.visibleRanges))}},pt=T.fromClass(ft,{decorations:e=>e.decorations});function mt(){return[pt,it]}var ht=n(),gt=56;function _t(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&p.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(p.test(n.line(e).text)){r=e+1;break}}let i=m(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:y.cursor(r.from),effects:D.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function vt(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:y.cursor(r),effects:D.scrollIntoView(r,{y:`center`})}),e.focus()})}function yt(e,t){let n=e.state.doc,r=Math.min(Math.max(t.line,1),n.lines),i=n.line(r),a=Math.min(i.from+Math.max(0,t.column-1),i.to);e.dispatch({selection:y.cursor(a),effects:D.scrollIntoView(a,{y:`start`})}),e.focus()}function bt(e){let t=(0,xe.c)(49),{docName:n,ytext:r,provider:l,placeholder:p,isSourceModeActive:m}=e,h=(0,I.useRef)(null),_=(0,I.useRef)(null),[v,y]=(0,I.useState)(null);if(v)throw v;let{resolvedTheme:b}=c(),{merged:x}=he(),fe=(0,I.useRef)(m),S=x?.editor?.wordWrap??!0,{data:C}=ue(n),w;t[0]!==C?.effective||t[1]!==x?(w=C?.effective??(x?.contentRules?g(x.contentRules):te),t[0]=C?.effective,t[1]=x,t[2]=w):w=t[2];let T=w,O;t[3]===T?O=t[4]:(O=JSON.stringify(T),t[3]=T,t[4]=O);let k=O,A,j;t[5]===m?(A=t[6],j=t[7]):(A=()=>{fe.current=m},j=[m],t[5]=m,t[6]=A,t[7]=j),(0,I.useEffect)(A,j);let M=(0,I.useRef)(null),N;t[8]!==n||t[9]!==T||t[10]!==p||t[11]!==l||t[12]!==b||t[13]!==S||t[14]!==r?(N=()=>{let e=h.current;if(!e)return;let t=l.configuration.name??``,c,d=Ct;try{c=o({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let o=null,s=a({ydoc:l.document,ytext:r}),c=new E,ee=new E,te=new E,m=new E,h=new D({state:de.create({doc:r.toString(),extensions:[ye,ve({scrollToMatch:St}),me.of([u]),be(r,l.awareness),...f({themeCompartment:c,resolvedTheme:b,ydoc:l.document,wordWrapCompartment:ee,wordWrap:S,currentDocName:t}),mt(),m.of(qe(T,n)),s,D.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,ae(t,`source`,se(e.view)),_e(t,`source`,ge(e.view,t))},120))}),D.domEventHandlers({keydown:(e,t)=>!fe.current||!ne()||!le(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),i(),!0)}),te.of(pe(p??``)),D.theme({"&":{height:`100%`}}),D.scrollMargins.of(xt)]}),parent:e});ae(t,`source`,se(h)),_e(t,`source`,ge(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,d),g.addEventListener(`paste`,d),g.addEventListener(`drop`,d),g.addEventListener(`cut`,d),{view:h,ydoc:l.document,ytext:r,provider:l,themeCompartment:c,wordWrapCompartment:ee,placeholderCompartment:te,lintCompartment:m}}}),M.current=c,_.current=c.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),M.current=null,_.current=null,y(t instanceof Error?t:Error(String(t)))}return()=>{let e=M.current;e&&s(e),M.current=null,_.current=null}},t[8]=n,t[9]=T,t[10]=p,t[11]=l,t[12]=b,t[13]=S,t[14]=r,t[15]=N):N=t[15];let P;t[16]!==l||t[17]!==r?(P=[r,l],t[16]=l,t[17]=r,t[18]=P):P=t[18],(0,I.useEffect)(N,P);let F,L;t[19]===n?(F=t[20],L=t[21]):(F=()=>{},L=[n],t[19]=n,t[20]=F,t[21]=L),(0,I.useEffect)(F,L);let R,z;t[22]===b?(R=t[23],z=t[24]):(z=()=>{let e=M.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(b===`dark`?d:ee)})},R=[b],t[22]=b,t[23]=R,t[24]=z),(0,I.useEffect)(z,R);let B,V;t[25]===S?(B=t[26],V=t[27]):(B=()=>{let e=M.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(S?D.lineWrapping:[])})},V=[S],t[25]=S,t[26]=B,t[27]=V),(0,I.useEffect)(B,V);let H,U;t[28]===p?(H=t[29],U=t[30]):(H=()=>{let e=M.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(pe(p??``))})},U=[p],t[28]=p,t[29]=H,t[30]=U),(0,I.useEffect)(H,U);let W;t[31]!==n||t[32]!==T?(W=()=>{let e=M.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(qe(T,n))})},t[31]=n,t[32]=T,t[33]=W):W=t[33];let G;t[34]===k?G=t[35]:(G=[k],t[34]=k,t[35]=G),(0,I.useEffect)(W,G);let K,q;t[36]!==n||t[37]!==m?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!m)return;let r=_.current;r&&(_t(r,t),ie(n))};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},q=[n,m],t[36]=n,t[37]=m,t[38]=K,t[39]=q):(K=t[38],q=t[39]),(0,I.useEffect)(K,q);let J,Y;t[40]!==n||t[41]!==m?(J=()=>{let e=function(e){let t=e.detail;if(!t||!m)return;let r=_.current;r&&(yt(r,t),ie(n))};return window.addEventListener(re,e),()=>window.removeEventListener(re,e)},Y=[n,m],t[40]=n,t[41]=m,t[42]=J,t[43]=Y):(J=t[42],Y=t[43]),(0,I.useEffect)(J,Y);let X,Z;t[44]!==n||t[45]!==m?(X=()=>{if(!m)return;let e=_.current;if(!e)return;let t=oe(n);if(t){if(t.kind===`outline`){_t(e,t.detail);return}if(t.kind===`lint`){yt(e,t.detail);return}vt(e,t.detail)}},Z=[n,m],t[44]=n,t[45]=m,t[46]=X,t[47]=Z):(X=t[46],Z=t[47]),(0,I.useEffect)(X,Z);let Q;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,ht.jsx)(`div`,{ref:h,className:`source-editor h-full pb-3`}),t[48]=Q):Q=t[48],Q}function xt(){return{top:gt}}function St(e){return D.scrollIntoView(e,{y:`start`})}function Ct(){return l()}export{bt as SourceEditor};
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{B as i,M as a,dt as o,ft as s}from"./DocumentContext-CNzSFsI-.js";import{n as c}from"./dist-DA2I9IQS.js";import{O as l,P as u,a as d,i as f,o as ee}from"./CodeMirrorPropInput-cmSiPzan.js";import{I as p,T as te,gn as m,ur as h,xi as ne,zr as g}from"./dist-DkRtDyLN.js";import{c as re,f as ie,n as ae,p as oe,r as se,u as ce}from"./typing-burst-detector-CekoPsaO.js";import{_ as le,a as ue}from"./lint-config-client-CX_cssoL.js";import"./config-provider-DVy-GqC5.js";import{$ as _,Bt as v,Dt as de,Et as y,Ft as b,J as x,Mt as fe,Ot as S,P as C,Pt as w,Q as T,Tt as E,X as D,Z as O,_t as k,at as A,ft as j,jt as M,lt as N,pt as pe,ut as me,vt as P,yt as F}from"./dist-CdtMC9tO.js";import{n as he}from"./config-context-DBmRI7_N.js";import{o as ge,r as _e}from"./selection-context-BjmeTT0v.js";import{n as ve,t as ye}from"./dist-Dl_HewkW.js";import{t as be}from"./src-CBkac3Ms.js";var I=e(t(),1),xe=r(),L=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},R=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet($).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new fe,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=Ne(s);if(i)o.add(n,n,x.widget({widget:new Ee(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,x.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,z(f))}};function z(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new L(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new L(r.from,n,r.diagnostic)}),r}function B(e,t){let n=t.pos,r=t.end||n,i=e.state.facet($).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(U))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function V(e,t){return e.field(K,!1)?t:t.concat(w.appendConfig.of(We))}function H(e,t){return{effects:V(e,[U.of(t)])}}var U=w.define(),W=w.define(),G=w.define(),K=b.define({create(){return new R(x.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=z(n,e.selected.diagnostic,i)||z(n,null,i)}!n.size&&i&&t.state.facet($).autoPanel&&(i=null),e=new R(n,i,r)}for(let n of t.effects)if(n.is(U)){let r=t.state.facet($).autoPanel?n.value.length?Oe.open:null:e.panel;e=R.init(n.value,r,t.state)}else n.is(W)?e=new R(e.diagnostics,n.value?Oe.open:null,e.selected):n.is(G)&&(e=new R(e.diagnostics,e.panel,n.value));return e},provide:e=>[k.from(e,e=>e.panel),D.decorations.from(e,e=>e.diagnostics)]}),q=x.mark({class:`cm-lintRange cm-lintRange-active`});function J(e,t,n){let{diagnostics:r}=e.state.field(K),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet($).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:!0,create(){return{dom:Y(e,i)}}}:null}function Y(e,t){return F(`ul`,{class:`cm-tooltip-lint`},t.map(t=>Te(e,t,!1)))}var X=e=>{let t=e.state.field(K,!1);return!t||!t.panel?!1:(e.dispatch({effects:W.of(!1)}),!0)},Z=T.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet($);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet($);t.length&&Q(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(H(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{j(this.view.state,e)})}}update(e){let t=e.state.facet($);(e.docChanged||t!=e.startState.facet($)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function Q(e,t,n){let r=[],i=-1;for(let a of e)a.then(n=>{r.push(n),clearTimeout(i),r.length==e.length?t(r):i=setTimeout(()=>t(r),200)},n)}var $=S.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...v(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Se,tooltipFilter:Se,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function Se(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Ce(e,t={}){return[$.of({source:e,config:t}),Z,We]}function we(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function Te(e,t,n){let r=n?we(t.actions):[];return F(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},F(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=z(e.state.field(K).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),F(`u`,s.slice(c,c+1)),s.slice(c+1)];return F(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&F(`div`,{class:`cm-diagnosticSource`},t.source))}var Ee=class extends _{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return F(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},De=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=Te(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},Oe=class e{constructor(e){this.view=e,this.items=[],this.list=F(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)X(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=we(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=z(this.view.state.field(K).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=F(`div`,{class:`cm-panel-lint`},this.list,F(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>X(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(K).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(K),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new De(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new De(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=z(this.view.state.field(K).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:G.of(t)})}static open(t){return new e(t)}};function ke(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function Ae(e){return ke(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var je=D.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:Ae(`#f11`)},".cm-lintRange-warning":{backgroundImage:Ae(`orange`)},".cm-lintRange-info":{backgroundImage:Ae(`#999`)},".cm-lintRange-hint":{backgroundImage:Ae(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function Me(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function Ne(e){let t=`hint`,n=1;for(let r of e){let e=Me(r.severity);e>n&&(n=e,t=r.severity)}return t}var Pe=class extends O{constructor(e){super(),this.diagnostics=e,this.severity=Ne(e)}toDOM(e){let t=document.createElement(`div`);t.className=`cm-lint-marker cm-lint-marker-`+this.severity;let n=this.diagnostics,r=e.state.facet(Ge).tooltipFilter;return r&&(n=r(n,e.state)),n.length&&(t.onmouseover=()=>Ie(e,t,n)),t}};function Fe(e,t){let n=r=>{let i=t.getBoundingClientRect();if(!(r.clientX>i.left-10&&r.clientX<i.right+10&&r.clientY>i.top-10&&r.clientY<i.bottom+10)){for(let e=r.target;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains(`cm-tooltip-lint`))return;window.removeEventListener(`mousemove`,n),e.state.field(Ve)&&e.dispatch({effects:Be.of(null)})}};window.addEventListener(`mousemove`,n)}function Ie(e,t,n){function r(){let r=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(r.from)&&e.dispatch({effects:Be.of({pos:r.from,above:!1,clip:!1,create(){return{dom:Y(e,n),getCoords:()=>t.getBoundingClientRect()}}})}),t.onmouseout=t.onmousemove=null,Fe(e,t)}let{hoverTime:i}=e.state.facet(Ge),a=setTimeout(r,i);t.onmouseout=()=>{clearTimeout(a),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(a),a=setTimeout(r,i)}}function Le(e,t){let n=Object.create(null);for(let r of t){let t=e.lineAt(r.from);(n[t.from]||(n[t.from]=[])).push(r)}let r=[];for(let e in n)r.push(new Pe(n[e]).range(+e));return M.of(r,!0)}var Re=A({class:`cm-gutter-lint`,markers:e=>e.state.field(ze),widgetMarker:(e,t,n)=>{let r=[];return e.state.field(ze).between(n.from,n.to,(e,t,i)=>{e>n.from&&e<n.to&&r.push(...i.diagnostics)}),r.length?new Pe(r):null}}),ze=b.define({create(){return M.empty},update(e,t){e=e.map(t.changes);let n=t.state.facet(Ge).markerFilter;for(let r of t.effects)if(r.is(U)){let i=r.value;n&&(i=n(i||[],t.state)),e=Le(t.state.doc,i.slice(0))}return e}}),Be=w.define(),Ve=b.define({create(){return null},update(e,t){return e&&t.docChanged&&(e=B(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(Be)?t.value:e,e)},provide:e=>P.from(e)}),He=D.baseTheme({".cm-gutter-lint":{width:`1.4em`,"& .cm-gutterElement":{padding:`.2em`}},".cm-lint-marker":{width:`1em`,height:`1em`},".cm-lint-marker-info":{content:ke(`<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>`)},".cm-lint-marker-warning":{content:ke(`<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>`)},".cm-lint-marker-error":{content:ke(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)}}),Ue=N(J,{hideOn:B}),We=[K,D.decorations.compute([K],e=>{let{selected:t,panel:n}=e.field(K);return!t||!n||t.from==t.to?x.none:x.set([q.range(t.from,t.to)])}),Ue,je],Ge=S.define({combine(e){return v(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function Ke(e={}){return[Ge.of(e),ze,Re,He,Ve]}function qe(e,t){return e.enabled?[Ke(),Ce(async n=>Ye(n.state.doc,await h(n.state.doc.toString(),e,t)),{delay:600})]:[]}function Je(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 Ye(e,t){let n=[];for(let r of t){let t=Je(e,r.range.start),i=Je(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=Xe(r);o&&(a.actions=[o]),n.push(a)}return n}function Xe(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:Je(n,e.range.start),to:Je(n,e.range.end),insert:e.newText}))})}}}var Ze=x.mark({class:`cm-link-ref-broken`}),Qe=/^\s{0,3}\[([^\]]+)\]:\s/,$e=/\[([^\]]*)\]\[([^\]]*)\]/g,et=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function tt(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 nt(e){let t=[];return C(e).iterate({enter(e){if(et.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function rt(e){let t=new Set,n=[],r=e.doc,i=nt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(tt(n.from,i))continue;let a=Qe.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!tt(t.from,i)&&!Qe.test(t.text))for($e.lastIndex=0;;){let e=$e.exec(t.text);if(!e)break;let r=t.from+e.index;if(tt(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(Ze.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),x.set(a)}var it=b.define({create(e){return rt(e)},update(e,t){return t.docChanged?rt(t.state):e},provide:e=>D.decorations.from(e)}),at=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,ot=x.mark({class:`cm-del`}),st=x.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),ct=x.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function lt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function ut(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!p.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(p.test(r.text))return{from:t.from,to:r.to}}return null}function dt(e,t){let n=[],r=C(e),i=ut(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(ot.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=at.exec(r.text),a=i?i[1].length:2,o=x.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=lt(r.text),a=x.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(st.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(ct.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(ct.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),x.set(n)}var ft=class{decorations;constructor(e){this.decorations=dt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||C(e.startState)!==C(e.state))&&(this.decorations=dt(e.view.state,e.view.visibleRanges))}},pt=T.fromClass(ft,{decorations:e=>e.decorations});function mt(){return[pt,it]}var ht=n(),gt=56;function _t(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&p.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(p.test(n.line(e).text)){r=e+1;break}}let i=m(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:y.cursor(r.from),effects:D.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function vt(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:y.cursor(r),effects:D.scrollIntoView(r,{y:`center`})}),e.focus()})}function yt(e,t){let n=e.state.doc,r=Math.min(Math.max(t.line,1),n.lines),i=n.line(r),a=Math.min(i.from+Math.max(0,t.column-1),i.to);e.dispatch({selection:y.cursor(a),effects:D.scrollIntoView(a,{y:`start`})}),e.focus()}function bt(e){let t=(0,xe.c)(49),{docName:n,ytext:r,provider:l,placeholder:p,isSourceModeActive:m}=e,h=(0,I.useRef)(null),_=(0,I.useRef)(null),[v,y]=(0,I.useState)(null);if(v)throw v;let{resolvedTheme:b}=c(),{merged:x}=he(),fe=(0,I.useRef)(m),S=x?.editor?.wordWrap??!0,{data:C}=ue(n),w;t[0]!==C?.effective||t[1]!==x?(w=C?.effective??(x?.contentRules?g(x.contentRules):te),t[0]=C?.effective,t[1]=x,t[2]=w):w=t[2];let T=w,O;t[3]===T?O=t[4]:(O=JSON.stringify(T),t[3]=T,t[4]=O);let k=O,A,j;t[5]===m?(A=t[6],j=t[7]):(A=()=>{fe.current=m},j=[m],t[5]=m,t[6]=A,t[7]=j),(0,I.useEffect)(A,j);let M=(0,I.useRef)(null),N;t[8]!==n||t[9]!==T||t[10]!==p||t[11]!==l||t[12]!==b||t[13]!==S||t[14]!==r?(N=()=>{let e=h.current;if(!e)return;let t=l.configuration.name??``,c,d=Ct;try{c=o({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let o=null,s=a({ydoc:l.document,ytext:r}),c=new E,ee=new E,te=new E,m=new E,h=new D({state:de.create({doc:r.toString(),extensions:[ye,ve({scrollToMatch:St}),me.of([u]),be(r,l.awareness),...f({themeCompartment:c,resolvedTheme:b,ydoc:l.document,wordWrapCompartment:ee,wordWrap:S,currentDocName:t}),mt(),m.of(qe(T,n)),s,D.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,ae(t,`source`,se(e.view)),_e(t,`source`,ge(e.view,t))},120))}),D.domEventHandlers({keydown:(e,t)=>!fe.current||!ne()||!le(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),i(),!0)}),te.of(pe(p??``)),D.theme({"&":{height:`100%`}}),D.scrollMargins.of(xt)]}),parent:e});ae(t,`source`,se(h)),_e(t,`source`,ge(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,d),g.addEventListener(`paste`,d),g.addEventListener(`drop`,d),g.addEventListener(`cut`,d),{view:h,ydoc:l.document,ytext:r,provider:l,themeCompartment:c,wordWrapCompartment:ee,placeholderCompartment:te,lintCompartment:m}}}),M.current=c,_.current=c.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),M.current=null,_.current=null,y(t instanceof Error?t:Error(String(t)))}return()=>{let e=M.current;e&&s(e),M.current=null,_.current=null}},t[8]=n,t[9]=T,t[10]=p,t[11]=l,t[12]=b,t[13]=S,t[14]=r,t[15]=N):N=t[15];let P;t[16]!==l||t[17]!==r?(P=[r,l],t[16]=l,t[17]=r,t[18]=P):P=t[18],(0,I.useEffect)(N,P);let F,L;t[19]===n?(F=t[20],L=t[21]):(F=()=>{},L=[n],t[19]=n,t[20]=F,t[21]=L),(0,I.useEffect)(F,L);let R,z;t[22]===b?(R=t[23],z=t[24]):(z=()=>{let e=M.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(b===`dark`?d:ee)})},R=[b],t[22]=b,t[23]=R,t[24]=z),(0,I.useEffect)(z,R);let B,V;t[25]===S?(B=t[26],V=t[27]):(B=()=>{let e=M.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(S?D.lineWrapping:[])})},V=[S],t[25]=S,t[26]=B,t[27]=V),(0,I.useEffect)(B,V);let H,U;t[28]===p?(H=t[29],U=t[30]):(H=()=>{let e=M.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(pe(p??``))})},U=[p],t[28]=p,t[29]=H,t[30]=U),(0,I.useEffect)(H,U);let W;t[31]!==n||t[32]!==T?(W=()=>{let e=M.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(qe(T,n))})},t[31]=n,t[32]=T,t[33]=W):W=t[33];let G;t[34]===k?G=t[35]:(G=[k],t[34]=k,t[35]=G),(0,I.useEffect)(W,G);let K,q;t[36]!==n||t[37]!==m?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!m)return;let r=_.current;r&&(_t(r,t),ie(n))};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},q=[n,m],t[36]=n,t[37]=m,t[38]=K,t[39]=q):(K=t[38],q=t[39]),(0,I.useEffect)(K,q);let J,Y;t[40]!==n||t[41]!==m?(J=()=>{let e=function(e){let t=e.detail;if(!t||!m)return;let r=_.current;r&&(yt(r,t),ie(n))};return window.addEventListener(re,e),()=>window.removeEventListener(re,e)},Y=[n,m],t[40]=n,t[41]=m,t[42]=J,t[43]=Y):(J=t[42],Y=t[43]),(0,I.useEffect)(J,Y);let X,Z;t[44]!==n||t[45]!==m?(X=()=>{if(!m)return;let e=_.current;if(!e)return;let t=oe(n);if(t){if(t.kind===`outline`){_t(e,t.detail);return}if(t.kind===`lint`){yt(e,t.detail);return}vt(e,t.detail)}},Z=[n,m],t[44]=n,t[45]=m,t[46]=X,t[47]=Z):(X=t[46],Z=t[47]),(0,I.useEffect)(X,Z);let Q;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,ht.jsx)(`div`,{ref:h,className:`source-editor h-full pb-3`}),t[48]=Q):Q=t[48],Q}function xt(){return{top:gt}}function St(e){return D.scrollIntoView(e,{y:`start`})}function Ct(){return l()}export{bt as SourceEditor};
@@ -1,4 +1,4 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{r as i}from"./dist-UKzQrqGt.js";import{n as a}from"./dist-DA2I9IQS.js";import{n as o,u as s}from"./createLucideIcon-DkO1lL_8.js";import{Jt as c,Nt as l,Pr as u}from"./dist-CurDB4OA.js";import{t as d}from"./x-DOZY99do.js";import{n as f}from"./dist-DyPw7rC6.js";import{d as p}from"./navigation-targets-D_g_oD3p.js";import{a as m,c as h,s as g}from"./doc-hash-CZiGDoto.js";import{t as _}from"./config-context-DBmRI7_N.js";import{E as v,f as y,m as b}from"./file-tree-adapter-Dubqn9yJ.js";var x=r(),S=2,C=1,w=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(S,Math.floor(u/e.css.cell.width)),rows:Math.max(C,Math.floor(l/e.css.cell.height))}}},T=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ee=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function te(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var D=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<T.length;++e)E.fill(0,T[e][0],T[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:te(e,ee)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Xe.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Xe.createPropertyValue(0,n,r)}},ne=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?A.isErrorNoTelemetry(e)?new A(e.message+`
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{r as i}from"./dist-UKzQrqGt.js";import{n as a}from"./dist-DA2I9IQS.js";import{n as o,u as s}from"./createLucideIcon-DkO1lL_8.js";import{Jt as c,Nt as l,Pr as u}from"./dist-DkRtDyLN.js";import{t as d}from"./x-DOZY99do.js";import{n as f}from"./dist-DyPw7rC6.js";import{d as p}from"./navigation-targets-S-8o5DE_.js";import{a as m,c as h,s as g}from"./doc-hash-BDRwCcvB.js";import{t as _}from"./config-context-DBmRI7_N.js";import{E as v,f as y,m as b}from"./file-tree-adapter-_1h6_EGw.js";var x=r(),S=2,C=1,w=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(S,Math.floor(u/e.css.cell.width)),rows:Math.max(C,Math.floor(l/e.css.cell.height))}}},T=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ee=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function te(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var D=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<T.length;++e)E.fill(0,T[e][0],T[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:te(e,ee)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Xe.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Xe.createPropertyValue(0,n,r)}},ne=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?A.isErrorNoTelemetry(e)?new A(e.message+`
2
2
 
3
3
  `+e.stack):Error(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{r as e,t}from"./compiler-runtime-B6sxACDP.js";import{t as n}from"./createLucideIcon-DkO1lL_8.js";import{l as r}from"./workspace-paths-DGpjh0_R.js";import{a as i,i as a,n as o,t as s}from"./cursor-Cw-gHVjo.js";var c=n(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),l=t(),u=e();function d(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Cline icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Windsurf icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var p=class{map=new Map;constructor(e){if(this.limit=e,e<=0)throw Error(`LruStringCache: limit must be > 0 (got ${e})`)}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}set(e,t){for(this.map.has(e)&&this.map.delete(e),this.map.set(e,t);this.map.size>this.limit;){let e=this.map.keys().next().value;if(e===void 0)break;this.map.delete(e)}}clear(){this.map.clear()}get size(){return this.map.size}};function m(e){let t=(0,l.c)(17),n,c;if(t[0]===e?(n=t[1],c=t[2]):({icon:n,...c}=e,t[0]=e,t[1]=n,t[2]=c),n===`claude`){let e;return t[3]===c?e=t[4]:(e=(0,u.jsx)(i,{...c}),t[3]=c,t[4]=e),e}if(n===`cursor`){let e;return t[5]===c?e=t[6]:(e=(0,u.jsx)(s,{...c}),t[5]=c,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===c?e=t[8]:(e=(0,u.jsx)(f,{...c}),t[7]=c,t[8]=e),e}if(n===`openai`){let e;return t[9]===c?e=t[10]:(e=(0,u.jsx)(a,{...c}),t[9]=c,t[10]=e),e}if(n===`cline`){let e;return t[11]===c?e=t[12]:(e=(0,u.jsx)(d,{...c}),t[11]=c,t[12]=e),e}if(n===`github`){let e;return t[13]===c?e=t[14]:(e=(0,u.jsx)(o,{...c}),t[13]=c,t[14]=e),e}let p=c,m;return t[15]===p?m=t[16]:(m=(0,u.jsx)(r,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}function h(e){return typeof e==`object`&&!!e&&typeof e.getStates==`function`}function g(e,t,n){let r=[],i=[];for(let a of e.getStates().values()){let e=a.agentPresence;if(e)for(let[a,o]of Object.entries(e))o.currentDoc&&(n-o.ts>=5e3||(o.currentDoc===t?r.push({agentId:a,entry:o}):i.push({agentId:a,entry:o})))}return{current:r,crossDoc:i}}export{f as a,p as i,g as n,d as o,m as r,c as s,h as t};
1
+ import{r as e,t}from"./compiler-runtime-B6sxACDP.js";import{t as n}from"./createLucideIcon-DkO1lL_8.js";import{l as r}from"./workspace-paths-r1tSwfOd.js";import{a as i,i as a,n as o,t as s}from"./cursor-Cw-gHVjo.js";var c=n(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),l=t(),u=e();function d(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Cline icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Windsurf icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var p=class{map=new Map;constructor(e){if(this.limit=e,e<=0)throw Error(`LruStringCache: limit must be > 0 (got ${e})`)}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}set(e,t){for(this.map.has(e)&&this.map.delete(e),this.map.set(e,t);this.map.size>this.limit;){let e=this.map.keys().next().value;if(e===void 0)break;this.map.delete(e)}}clear(){this.map.clear()}get size(){return this.map.size}};function m(e){let t=(0,l.c)(17),n,c;if(t[0]===e?(n=t[1],c=t[2]):({icon:n,...c}=e,t[0]=e,t[1]=n,t[2]=c),n===`claude`){let e;return t[3]===c?e=t[4]:(e=(0,u.jsx)(i,{...c}),t[3]=c,t[4]=e),e}if(n===`cursor`){let e;return t[5]===c?e=t[6]:(e=(0,u.jsx)(s,{...c}),t[5]=c,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===c?e=t[8]:(e=(0,u.jsx)(f,{...c}),t[7]=c,t[8]=e),e}if(n===`openai`){let e;return t[9]===c?e=t[10]:(e=(0,u.jsx)(a,{...c}),t[9]=c,t[10]=e),e}if(n===`cline`){let e;return t[11]===c?e=t[12]:(e=(0,u.jsx)(d,{...c}),t[11]=c,t[12]=e),e}if(n===`github`){let e;return t[13]===c?e=t[14]:(e=(0,u.jsx)(o,{...c}),t[13]=c,t[14]=e),e}let p=c,m;return t[15]===p?m=t[16]:(m=(0,u.jsx)(r,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}function h(e){return typeof e==`object`&&!!e&&typeof e.getStates==`function`}function g(e,t,n){let r=[],i=[];for(let a of e.getStates().values()){let e=a.agentPresence;if(e)for(let[a,o]of Object.entries(e))o.currentDoc&&(n-o.ts>=5e3||(o.currentDoc===t?r.push({agentId:a,entry:o}):i.push({agentId:a,entry:o})))}return{current:r,crossDoc:i}}export{f as a,p as i,g as n,d as o,m as r,c as s,h as t};
@@ -1,4 +1,4 @@
1
- import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{C as i,E as a,En as o,Ht as s,S as c,T as l,Vt as u,n as d,w as f,wn as p,x as m,zt as h}from"./DocumentContext-ogFq9Apo.js";import{n as g,r as _}from"./dist-UKzQrqGt.js";import{l as v,n as y,t as b,u as x}from"./createLucideIcon-DkO1lL_8.js";import{d as S}from"./dist-D9SQx2Kz.js";import{i as C,n as w,t as T}from"./tooltip-C0qAzcHx.js";import{a as E,c as D,i as O,n as k,o as A,s as j,t as M}from"./dialog-DFGKErvF.js";import{_t as N}from"./CodeMirrorPropInput-f5pC607I.js";import{E as P,_ as F,h as I,l as L,p as R}from"./skills-api-ChqmqNEn.js";import{t as z}from"./label-rnTtsCxb.js";import{n as B,t as V}from"./radio-group-Bmt_-6b7.js";import{Dt as H,Et as U,Hr as W,Ir as G,It as K,Ot as q,St as J,Tt as ee,ft as te,sa as ne}from"./dist-CurDB4OA.js";import{t as re}from"./trace-api-BIWqyPc9.js";import{a as ie,l as ae,n as oe,r as se,t as ce}from"./EnableSyncConfirmDialog-CEMiBdy3.js";import{t as le}from"./arrow-up-right-hiEaTtOQ.js";import{t as ue}from"./check-YcLXnBws.js";import{n as de}from"./CopyButton-CMJPcMjt.js";import{o as fe}from"./prop-types-r4lrTXmC.js";import{i as pe,o as me,w as he}from"./skill-actions-CqFXEGI_.js";import{i as ge,o as _e,s as ve,u as ye}from"./workspace-paths-DGpjh0_R.js";import{t as be}from"./copy-CJtHLQXD.js";import{i as xe,o as Se,r as Ce}from"./open-managed-artifact-tab-jUT5uxaf.js";import{t as we}from"./loader-circle-CLDbHvUo.js";import{t as Te}from"./refresh-cw-Cbbnmwxa.js";import{t as Ee}from"./trash-2-BByztZ1L.js";import{t as De}from"./triangle-alert-BRg1-EjD.js";import{t as Oe}from"./x-DOZY99do.js";import{n as ke}from"./dist-DyPw7rC6.js";import{t as Ae}from"./input-C1P6Hf22.js";import{t as je}from"./parse-api-error-BcfaIWfX.js";import{t as Y}from"./dist-D6ZXVw3E.js";import{c as Me,o as Ne}from"./documents-events-BgIyZo2W.js";import{a as Pe,m as Fe,s as Ie}from"./doc-hash-CZiGDoto.js";import{_ as Le,g as Re}from"./lint-config-client-VuF6BI2d.js";import"./config-provider-BGFykK9q.js";import{n as ze}from"./config-context-DBmRI7_N.js";import{t as Be}from"./external-link-BfiFPJEx.js";import{n as Ve,t as He}from"./clipboard-adapter-BHfhAZ-n.js";import{t as Ue}from"./textarea-BdasFVsT.js";var X=e(t(),1),Z=n(),We=`Separator`,Ge=`horizontal`,Ke=[`horizontal`,`vertical`],qe=X.forwardRef((e,t)=>{let{decorative:n,orientation:r=Ge,...i}=e,a=Je(r)?r:Ge,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Z.jsx)(S.div,{"data-orientation":a,...o,...i,ref:t})});qe.displayName=We;function Je(e){return Ke.includes(e)}var Ye=qe,Xe=b(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ze=b(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Qe=b(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),$e=b(`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`}]]),et=b(`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`}]]),tt=b(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),nt=b(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),rt=b(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=r();function it(e){let t=(0,Q.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,X.useState)(n),[a,o]=(0,X.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return Me(()=>{o(ct)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,X.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(ot).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,X.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(at),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function at(e){return e+1}async function ot(e){if(!e.ok){let t=await e.json().catch(st);throw Error(je(t)??`HTTP ${e.status}`)}return e.json()}function st(){return null}function ct(e){return e+1}function lt(){let e=(0,Q.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,X.useState)(t),[i,a]=(0,X.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Me(()=>{a(ft)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,X.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(ut).then(t=>{if(e)return;let n=K.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete templates response.`});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,X.useEffect)(c,l),n}async function ut(e){if(!e.ok){let t=await e.json().catch(dt);throw Error(je(t)??`HTTP ${e.status}`)}return e.json()}function dt(){return null}function ft(e){return e+1}function pt(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=x(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Z.jsx)(Ye,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function mt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`group/field-group @container/field-group flex w-full flex-col gap-6 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ht=v(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function gt(e){let t=(0,Q.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=x(ht({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function _t(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(z,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`text-left text-1sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xt(e){let t=(0,Q.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(Ct)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,Z.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(St)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=x(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,Z.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function St(e){return e?.message&&(0,Z.jsx)(`li`,{children:e.message},e.message)}function Ct(e){return[e?.message,e]}async function wt(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function Tt(e){let t=(0,Q.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,X.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&wt().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,X.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return Ne(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,X.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var Et=`#settings`;function Dt(e){return Re(e.target)?!1:Le(e,`settings`)}function Ot(e){return e.replace(/^#/,``)===`settings`}function kt(){return typeof window>`u`?``:window.location.hash}function At(){let e=(0,Q.c)(4),[t,n]=(0,X.useState)(Mt),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,X.startTransition)(()=>{n(Ot(kt()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,X.useEffect)(r,i);let a=jt,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function jt(){typeof window>`u`||Ot(kt())&&window.history.back()}function Mt(){return Ot(kt())}var Nt=`open-knowledge-app`;function Pt(e){try{re.getTracer(Nt).startSpan(e).end()}catch(e){console.warn(`[terminal-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function Ft(){Pt(`ok.desktop.terminalOpened`)}function It(){Pt(`ok.desktop.shellConsentGranted`)}var Lt=`github.com`,Rt=new Map;async function zt(e){try{let t=await e.json(),n=te.safeParse(t);if(n.success)return n.data.title}catch{}}async function Bt(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function Vt(e){let t=e?.host??Lt,n=await Bt(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await zt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0}}function Ht(e){let t=e?.host??Lt,n=Rt.get(t);if(n)return n;let r=Vt(e).finally(()=>{Rt.delete(t)});return Rt.set(t,r),r}function Ut(e){let t=e.split(`
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t,r as n,t as r}from"./compiler-runtime-B6sxACDP.js";import{C as i,E as a,En as o,Ht as s,S as c,T as l,Vt as u,n as d,w as f,wn as p,x as m,zt as h}from"./DocumentContext-CNzSFsI-.js";import{n as g,r as _}from"./dist-UKzQrqGt.js";import{l as v,n as y,t as b,u as x}from"./createLucideIcon-DkO1lL_8.js";import{d as S}from"./dist-D9SQx2Kz.js";import{i as C,n as w,t as T}from"./tooltip-C0qAzcHx.js";import{a as E,c as D,i as O,n as k,o as A,s as j,t as M}from"./dialog-DFGKErvF.js";import{_t as N}from"./CodeMirrorPropInput-cmSiPzan.js";import{E as P,_ as F,h as I,l as L,p as R}from"./skills-api-UJqRM51N.js";import{t as z}from"./label-rnTtsCxb.js";import{n as B,t as V}from"./radio-group-Bmt_-6b7.js";import{Dt as H,Et as U,Hr as W,Ir as G,It as K,Ot as q,St as J,Tt as ee,ft as te,sa as ne}from"./dist-DkRtDyLN.js";import{t as re}from"./trace-api-BIWqyPc9.js";import{a as ie,l as ae,n as oe,r as se,t as ce}from"./EnableSyncConfirmDialog-D_NbuJ59.js";import{t as le}from"./arrow-up-right-hiEaTtOQ.js";import{t as ue}from"./check-YcLXnBws.js";import{n as de}from"./CopyButton-CMJPcMjt.js";import{o as fe}from"./prop-types-Cr0Uib4q.js";import{i as pe,o as me,w as he}from"./skill-actions-32qU2dgG.js";import{i as ge,o as _e,s as ve,u as ye}from"./workspace-paths-r1tSwfOd.js";import{t as be}from"./copy-CJtHLQXD.js";import{i as xe,o as Se,r as Ce}from"./open-managed-artifact-tab-tiXawScj.js";import{t as we}from"./loader-circle-CLDbHvUo.js";import{t as Te}from"./refresh-cw-Cbbnmwxa.js";import{t as Ee}from"./trash-2-BByztZ1L.js";import{t as De}from"./triangle-alert-BRg1-EjD.js";import{t as Oe}from"./x-DOZY99do.js";import{n as ke}from"./dist-DyPw7rC6.js";import{t as Ae}from"./input-C1P6Hf22.js";import{t as je}from"./parse-api-error-BcfaIWfX.js";import{t as Y}from"./dist-D6ZXVw3E.js";import{c as Me,o as Ne}from"./documents-events-CJpJUM_N.js";import{a as Pe,m as Fe,s as Ie}from"./doc-hash-BDRwCcvB.js";import{_ as Le,g as Re}from"./lint-config-client-CX_cssoL.js";import"./config-provider-DVy-GqC5.js";import{n as ze}from"./config-context-DBmRI7_N.js";import{t as Be}from"./external-link-BfiFPJEx.js";import{n as Ve,t as He}from"./clipboard-adapter-BHfhAZ-n.js";import{t as Ue}from"./textarea-BdasFVsT.js";var X=e(t(),1),Z=n(),We=`Separator`,Ge=`horizontal`,Ke=[`horizontal`,`vertical`],qe=X.forwardRef((e,t)=>{let{decorative:n,orientation:r=Ge,...i}=e,a=Je(r)?r:Ge,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Z.jsx)(S.div,{"data-orientation":a,...o,...i,ref:t})});qe.displayName=We;function Je(e){return Ke.includes(e)}var Ye=qe,Xe=b(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ze=b(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Qe=b(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),$e=b(`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`}]]),et=b(`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`}]]),tt=b(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),nt=b(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),rt=b(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=r();function it(e){let t=(0,Q.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,X.useState)(n),[a,o]=(0,X.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return Me(()=>{o(ct)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,X.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(ot).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,X.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(at),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function at(e){return e+1}async function ot(e){if(!e.ok){let t=await e.json().catch(st);throw Error(je(t)??`HTTP ${e.status}`)}return e.json()}function st(){return null}function ct(e){return e+1}function lt(){let e=(0,Q.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,X.useState)(t),[i,a]=(0,X.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Me(()=>{a(ft)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,X.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(ut).then(t=>{if(e)return;let n=K.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete templates response.`});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,X.useEffect)(c,l),n}async function ut(e){if(!e.ok){let t=await e.json().catch(dt);throw Error(je(t)??`HTTP ${e.status}`)}return e.json()}function dt(){return null}function ft(e){return e+1}function pt(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=x(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Z.jsx)(Ye,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function mt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`group/field-group @container/field-group flex w-full flex-col gap-6 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ht=v(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function gt(e){let t=(0,Q.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=x(ht({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function _t(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(z,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x(`text-left text-1sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xt(e){let t=(0,Q.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(Ct)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,Z.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(St)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=x(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,Z.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function St(e){return e?.message&&(0,Z.jsx)(`li`,{children:e.message},e.message)}function Ct(e){return[e?.message,e]}async function wt(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function Tt(e){let t=(0,Q.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,X.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&wt().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,X.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return Ne(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,X.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var Et=`#settings`;function Dt(e){return Re(e.target)?!1:Le(e,`settings`)}function Ot(e){return e.replace(/^#/,``)===`settings`}function kt(){return typeof window>`u`?``:window.location.hash}function At(){let e=(0,Q.c)(4),[t,n]=(0,X.useState)(Mt),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,X.startTransition)(()=>{n(Ot(kt()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,X.useEffect)(r,i);let a=jt,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function jt(){typeof window>`u`||Ot(kt())&&window.history.back()}function Mt(){return Ot(kt())}var Nt=`open-knowledge-app`;function Pt(e){try{re.getTracer(Nt).startSpan(e).end()}catch(e){console.warn(`[terminal-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function Ft(){Pt(`ok.desktop.terminalOpened`)}function It(){Pt(`ok.desktop.shellConsentGranted`)}var Lt=`github.com`,Rt=new Map;async function zt(e){try{let t=await e.json(),n=te.safeParse(t);if(n.success)return n.data.title}catch{}}async function Bt(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function Vt(e){let t=e?.host??Lt,n=await Bt(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await zt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0}}function Ht(e){let t=e?.host??Lt,n=Rt.get(t);if(n)return n;let r=Vt(e).finally(()=>{Rt.delete(t)});return Rt.set(t,r),r}function Ut(e){let t=e.split(`
2
2
  `);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function Wt(){return{status:Ht,async repos(e){let t=e?.host??`github.com`,n=await Bt(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await zt(n)??`Failed to fetch repositories`};let r=Ut(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||`Failed to fetch repositories`}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:`Failed to fetch repositories`};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await Bt(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await zt(t)}}}}function Gt(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function Kt(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
3
3
  `);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function qt(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}function Jt(){return{start(){return qt((e,t)=>{(async()=>{try{let n=await fetch(`/api/local-op/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({json:!0}),signal:t});if(!n.ok){let t=`Failed to start sign-in — try again`;try{let e=await n.json(),r=te.safeParse(e);r.success&&(t=r.data.title)}catch{}e({type:`error`,message:t});return}if(!n.body){e({type:`error`,message:`Failed to start sign-in — try again`});return}!await Kt(n.body,t=>{let n;try{n=JSON.parse(t)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,t.slice(0,100)),`continue`}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let t=n.problem;return e({type:`error`,message:t?.detail||t?.title||`Unknown error`}),`terminal`}let r=n;return e(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})&&!t.aborted&&e({type:`error`,message:`Sign-in stream ended without confirmation — please try again`})}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;e({type:`error`,message:`Connection error — try again`})}})()})}}}function Yt(e){return{start(){return e.localOp.auth.start()}}}async function Xt(e){try{await navigator.clipboard.writeText(e)}catch{}}var Zt=120*1e3;function Qt(e){let t=(0,Q.c)(25),{onSuccess:n,transport:r}=e,{_:i}=_(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(`https://github.com/login/device`),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(Zt),h=(0,X.useRef)(null),v=(0,X.useRef)(null),b;t[0]!==i||t[1]!==n||t[2]!==r?(b=async function(){f(null);try{let e=r.start();h.current=e.cancel;let t=e.events[Symbol.asyncIterator](),a=!1,s=await t.next();for(;!s.done;){let e=s.value;if(e.type===`verification`)o(e.user_code),c(e.verification_uri),m(e.expires_in*1e3),Xt(e.user_code).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)});else if(e.type===`complete`){a=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){a=!0,f(e.message);break}s=await t.next()}a||f(i({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&f(i({id:`Q5fqMz`}))}},t[0]=i,t[1]=n,t[2]=r,t[3]=b):b=t[3];let x=b,S;t[4]===x?S=t[5]:(S=()=>{let e=!1;return queueMicrotask(()=>{e||x()}),()=>{e=!0,h.current?.(),h.current=null,v.current&&clearInterval(v.current)}},t[4]=x,t[5]=S);let C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[6]=C):C=t[6],(0,X.useEffect)(S,C);let w,T;t[7]!==i||t[8]!==a?(w=()=>{if(!a)return;let e=Date.now();return v.current=setInterval(()=>{let t=Zt-(Date.now()-e);t<=0?(m(0),v.current&&clearInterval(v.current),f(i({id:`ve8vEM`}))):m(t)},1e3),()=>{v.current&&clearInterval(v.current)}},T=[a,i],t[7]=i,t[8]=a,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,X.useEffect)(w,T);let E=Math.floor(p/6e4),D=Math.floor(p%6e4/1e3),O;t[11]===D?O=t[12]:(O=D.toString().padStart(2,`0`),t[11]=D,t[12]=O);let k=`${E}:${O}`,A;t[13]!==i||t[14]!==l||t[15]!==d||t[16]!==k||t[17]!==a||t[18]!==s?(A=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`eVPynQ`,values:{verificationUri:s},components:{0:(0,Z.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Be(e,s),onAuxClick:e=>Be(e,s),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,Z.jsx)(`span`,{}),2:(0,Z.jsx)(le,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,Z.jsxs)(y,{type:`button`,variant:`outline`,"aria-label":i({id:`nCzR-G`,values:{userCode:a}}),onClick:()=>void Xt(a).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,Z.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:a}),(0,Z.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:l?(0,Z.jsx)(ue,{className:`size-4`}):(0,Z.jsx)(be,{className:`size-4`})})]}),(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:l?(0,Z.jsx)(g,{id:`80c4-P`}):null}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,Z.jsx)(g,{id:`5y_9lO`})]}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(g,{id:`gYz2ep`,values:{timeLabel:k}})})]})]}):(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:d?null:(0,Z.jsx)(g,{id:`aWlJai`})}),t[13]=i,t[14]=l,t[15]=d,t[16]=k,t[17]=a,t[18]=s,t[19]=A):A=t[19];let j;t[20]===d?j=t[21]:(j=d&&(0,Z.jsx)(`p`,{className:`text-1sm text-destructive`,children:d}),t[20]=d,t[21]=j);let M;return t[22]!==A||t[23]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[A,j]}),t[22]=A,t[23]=j,t[24]=M):M=t[24],M}function $t(e){let t=(0,Q.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:s}=_(),c;t[0]===n?c=t[1]:(c=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(g,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`gp3I7-`})}),t[2]=l):l=t[2];let u;t[3]===s?u=t[4]:(u=s({id:`6YtxFj`}),t[3]=s,t[4]=u);let d;t[5]!==s||t[6]!==n?(d=s({id:`J2Mv98`,values:{login:n}}),t[5]=s,t[6]=n,t[7]=d):d=t[7];let f;t[8]===i?f=t[9]:(f=e=>i(e.target.value),t[8]=i,t[9]=f);let p;t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==f?(p=(0,Z.jsx)(Ae,{"aria-label":u,placeholder:d,value:r,onChange:f}),t[10]=r,t[11]=u,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]===s?m=t[16]:(m=s({id:`O3oNi5`}),t[15]=s,t[16]=m);let h;t[17]===s?h=t[18]:(h=s({id:`O3oNi5`}),t[17]=s,t[18]=h);let v;t[19]===o?v=t[20]:(v=e=>o(e.target.value),t[19]=o,t[20]=v);let y;t[21]!==a||t[22]!==m||t[23]!==h||t[24]!==v?(y=(0,Z.jsx)(Ae,{type:`email`,"aria-label":m,placeholder:h,value:a,onChange:v}),t[21]=a,t[22]=m,t[23]=h,t[24]=v,t[25]=y):y=t[25];let b;return t[26]!==c||t[27]!==y||t[28]!==p?(b=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[c,l,p,y]}),t[26]=c,t[27]=y,t[28]=p,t[29]=b):b=t[29],b}var en=1e4;function tn(e){let t=(0,Q.c)(59),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s,queryTransport:c}=e,{_:l}=_(),u;t[0]===s?u=t[1]:(u=s??Jt(),t[0]=s,t[1]=u);let d=u,f;t[2]===c?f=t[3]:(f=c??Wt(),t[2]=c,t[3]=f);let p=f,[m,h]=(0,X.useState)(`auth`),[v,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(``),T,E;t[4]!==a||t[5]!==n?(T=()=>{n&&(b(null),S(``),w(``),h(a?`checking`:`auth`))},E=[n,a],t[4]=a,t[5]=n,t[6]=T,t[7]=E):(T=t[6],E=t[7]),(0,X.useLayoutEffect)(T,E);let N;t[8]!==a||t[9]!==n||t[10]!==p?(N=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,h(t))},r=setTimeout(()=>t(`auth`),en);return p.status().then(n=>{e||(n.authenticated?(b({login:n.login,name:n.name,email:n.email}),S(n.name??``),w(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[8]=a,t[9]=n,t[10]=p,t[11]=N):N=t[11];let P;t[12]!==a||t[13]!==n?(P=[n,a],t[12]=a,t[13]=n,t[14]=P):P=t[14],(0,X.useEffect)(N,P);let F;t[15]!==l||t[16]!==a||t[17]!==r||t[18]!==i?(F=function(e){if(b(e),a)S(e.name??``),w(e.email??``),h(`identity`);else{h(`done`),i?.(e),r(!1);let t=e.login;ke.success(l({id:`E_tNGD`,values:{login:t}}))}},t[15]=l,t[16]=a,t[17]=r,t[18]=i,t[19]=F):F=t[19];let I=F,L;t[20]!==l||t[21]!==v||t[22]!==r||t[23]!==i?(L=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(nn);let n={...v??{login:``},name:e,email:t};h(`done`),i?.(n),r(!1);let a=n.login;ke.success(l({id:`E_tNGD`,values:{login:a}}))},t[20]=l,t[21]=v,t[22]=r,t[23]=i,t[24]=L):L=t[24];let R=L,z;t[25]!==l||t[26]!==v||t[27]!==r||t[28]!==i?(z=function(){if(!v)return;h(`done`),i?.(v),r(!1);let e=v.login;ke.success(l({id:`E_tNGD`,values:{login:e}}))},t[25]=l,t[26]=v,t[27]=r,t[28]=i,t[29]=z):z=t[29];let B=z,V;t[30]===r?V=t[31]:(V=function(){r(!1)},t[30]=r,t[31]=V);let H=V,U;t[32]!==a||t[33]!==o||t[34]!==m?(U=(0,Z.jsx)(j,{children:(0,Z.jsx)(D,{children:o?(0,Z.jsx)(g,{id:`X8kjQX`}):a&&m!==`auth`?(0,Z.jsx)(g,{id:`29XZXN`}):(0,Z.jsx)(g,{id:`3jod3l`})})}),t[32]=a,t[33]=o,t[34]=m,t[35]=U):U=t[35];let W;t[36]===m?W=t[37]:(W=m===`checking`&&(0,Z.jsx)(k,{children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(g,{id:`gBbxn_`})})}),t[36]=m,t[37]=W);let G;t[38]!==I||t[39]!==H||t[40]!==d||t[41]!==m?(G=m===`auth`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{children:(0,Z.jsx)(Qt,{onSuccess:I,transport:d})}),(0,Z.jsx)(A,{children:(0,Z.jsx)(y,{variant:`outline`,className:`font-mono uppercase`,onClick:H,children:(0,Z.jsx)(g,{id:`dEgA5A`})})})]}),t[38]=I,t[39]=H,t[40]=d,t[41]=m,t[42]=G):G=t[42];let K;t[43]!==v||t[44]!==R||t[45]!==B||t[46]!==C||t[47]!==x||t[48]!==m?(K=m===`identity`&&v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{children:(0,Z.jsx)($t,{login:v.login,name:x,onNameChange:S,email:C,onEmailChange:w})}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(y,{variant:`ghost`,onClick:B,children:(0,Z.jsx)(g,{id:`6Uau97`})}),(0,Z.jsx)(y,{onClick:()=>R(x.trim(),C.trim()),disabled:!x.trim()||!C.trim(),children:(0,Z.jsx)(g,{id:`tfDRzk`})})]})]}),t[43]=v,t[44]=R,t[45]=B,t[46]=C,t[47]=x,t[48]=m,t[49]=K):K=t[49];let q;t[50]!==U||t[51]!==W||t[52]!==G||t[53]!==K?(q=(0,Z.jsxs)(O,{className:`sm:max-w-md`,children:[U,W,G,K]}),t[50]=U,t[51]=W,t[52]=G,t[53]=K,t[54]=q):q=t[54];let J;return t[55]!==r||t[56]!==n||t[57]!==q?(J=(0,Z.jsx)(M,{open:n,onOpenChange:r,children:q}),t[55]=r,t[56]=n,t[57]=q,t[58]=J):J=t[58],J}function nn(){}function rn(e){let t=(0,Q.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,l=(0,X.useId)(),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(g,{id:`3o3tur`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,Z.jsx)(vt,{htmlFor:l,children:u}),t[1]=l,t[2]=d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(bt,{children:(0,Z.jsx)(g,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,Z.jsx)(`code`,{className:`font-mono`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}})}),t[3]=f):f=t[3];let p;t[4]===r?p=t[5]:(p=e=>r(e.target.value),t[4]=r,t[5]=p);let m;t[6]!==s||t[7]!==l||t[8]!==a||t[9]!==c||t[10]!==p||t[11]!==n?(m=(0,Z.jsx)(Ue,{id:l,value:n,onChange:p,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=s,t[7]=l,t[8]=a,t[9]=c,t[10]=p,t[11]=n,t[12]=m):m=t[12];let h;return t[13]!==d||t[14]!==m?(h=(0,Z.jsxs)(gt,{children:[d,f,m]}),t[13]=d,t[14]=m,t[15]=h):h=t[15],h}var an=/^[A-Za-z0-9_-]+$/;function on(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function sn(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var cn=0;function ln(){return cn+=1,`prop-${cn}`}function un(e){let{frontmatter:t,body:n}=G(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of W(t).split(`
4
4
  `)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:ln(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function dn(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`