@inkeep/open-knowledge 0.47.1 → 0.47.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/{acp-harness-probe-qJUo1ApO.mjs → acp-harness-probe-QNrRVJhc.mjs} +2 -2
  2. package/dist/cli.mjs +7 -7
  3. package/dist/config-schema.json +10 -1
  4. package/dist/config.user.schema.json +10 -1
  5. package/dist/constants-C5EnGQBy.mjs +2 -0
  6. package/dist/fs-traced-C-HqiL6u.mjs +1 -0
  7. package/dist/{fs-traced-OS6B1cZZ.mjs → fs-traced-D12ehU8a.mjs} +2 -2
  8. package/dist/{git-handle-RLYVdszV.mjs → git-handle-CllEzrX4.mjs} +2 -2
  9. package/dist/git-handle-DJPLRe3o.mjs +1 -0
  10. package/dist/index.d.mts +1 -0
  11. package/dist/index.mjs +1 -1
  12. package/dist/{init-C55e2NNl.mjs → init-DL_j9FNQ.mjs} +3 -3
  13. package/dist/init-I4_eavst.mjs +1 -0
  14. package/dist/{launch-json-removal-D3Q9yvyd.mjs → launch-json-removal-B-K7szy8.mjs} +2 -2
  15. package/dist/{loader-BsX_JrrA.mjs → loader-Ro5TBLoF.mjs} +2 -2
  16. package/dist/loader-_DlE802w.mjs +1 -0
  17. package/dist/md-manager-DqRVEVmJ.mjs +2 -0
  18. package/dist/{open-browser-4sOlBbCM.mjs → open-browser-DiR8zaBV.mjs} +2 -2
  19. package/dist/parse-worker.mjs +1 -1
  20. package/dist/preview-CwNUTst2.mjs +1 -0
  21. package/dist/{preview-BAWt2Pnh.mjs → preview-CyVtre2s.mjs} +2 -2
  22. package/dist/public/assets/{ActivityModeContent-DnjDjPFp.js → ActivityModeContent-2l8BA531.js} +1 -1
  23. package/dist/public/assets/{AgentDiffPane-Th6j3NhO.js → AgentDiffPane-wqdF9lpR.js} +1 -1
  24. package/dist/public/assets/{AgentThreadClientBinder-BVm5Ldhz.js → AgentThreadClientBinder-56IhVeqo.js} +1 -1
  25. package/dist/public/assets/{ChangedOutsideBadge-DVfCTGd2.js → ChangedOutsideBadge-eT1ODdAD.js} +1 -1
  26. package/dist/public/assets/{CodeMirrorPropInput-DmM8F7PJ.js → CodeMirrorPropInput-L7fbBlLy.js} +1 -1
  27. package/dist/public/assets/{DocumentContext-B0g_vd8N.js → DocumentContext-DD95gIt4.js} +1 -1
  28. package/dist/public/assets/{EditorModeToggle-DKuXrb9b.js → EditorModeToggle-CR5jA0YM.js} +1 -1
  29. package/dist/public/assets/{EnableSyncConfirmDialog-BQttSYlY.js → EnableSyncConfirmDialog-C5fNw26t.js} +1 -1
  30. package/dist/public/assets/FeedbackForm-macxQS8x.js +1 -0
  31. package/dist/public/assets/{GraphPanel-DK2w8FEz.js → GraphPanel-BDGxPSvY.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-DHfVuiKL.js → ImportSkillDialog-B2ilfqxe.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-B-7Pe22_.js → LintConfigEditor-ByUOzhaw.js} +1 -1
  34. package/dist/public/assets/{ManagedArtifactProperties-B-Y5eayN.js → ManagedArtifactProperties-CVGjtd3P.js} +2 -2
  35. package/dist/public/assets/ManagedArtifactProperties-m1GRSrIt.js +1 -0
  36. package/dist/public/assets/{McpConsentDialogBody-DPMIdjmd.js → McpConsentDialogBody-B3ubISnW.js} +1 -1
  37. package/dist/public/assets/{MermaidDocEditor-CBHNf1No.js → MermaidDocEditor-CftVeU4U.js} +1 -1
  38. package/dist/public/assets/{ReportBugDialogBody-CXLxw7Fr.js → ReportBugDialogBody-CWbkwdNL.js} +1 -1
  39. package/dist/public/assets/{SchemaConfigEditor-DG-dOTBT.js → SchemaConfigEditor-UkvF3UAn.js} +1 -1
  40. package/dist/public/assets/{SessionsHost-DjbdveAp.js → SessionsHost-Pa6hY3sI.js} +2 -2
  41. package/dist/public/assets/{SettingsDialogBody-CFwua7VK.js → SettingsDialogBody-Be8P3Vqa.js} +1 -1
  42. package/dist/public/assets/{ShareBranchSwitchDialog-CyWPLWZG.js → ShareBranchSwitchDialog-BmGWQCY6.js} +1 -1
  43. package/dist/public/assets/{ShareReceiveDialog-C-fxd4DJ.js → ShareReceiveDialog-BoqZXYhT.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveMissDialog-Y4PyuUCZ.js → ShareReceiveMissDialog-B_DT1dz2.js} +1 -1
  45. package/dist/public/assets/{SkillEditBanner-Dbu0PwqP.js → SkillEditBanner-hcLaEQ2F.js} +1 -1
  46. package/dist/public/assets/{SkillOriginInline-DuFc7cZs.js → SkillOriginInline-CtSdZ4_j.js} +1 -1
  47. package/dist/public/assets/{SkillToolbarControls-B4k3LXLX.js → SkillToolbarControls-DQYbvJTe.js} +1 -1
  48. package/dist/public/assets/{SourceEditor-BCMM4zJn.js → SourceEditor-DX9L1Mci.js} +1 -1
  49. package/dist/public/assets/{TerminalPanel-DkXL03UX.js → TerminalPanel-WTiFd3Z6.js} +1 -1
  50. package/dist/public/assets/{TerminalWindowApp-DH34WwKL.js → TerminalWindowApp-CnhrK_tv.js} +1 -1
  51. package/dist/public/assets/{TextDocEditor-DEdxUQxb.js → TextDocEditor-BGlQEeBq.js} +1 -1
  52. package/dist/public/assets/{ThreadView-ktubIY9d.js → ThreadView-CExveDEV.js} +1 -1
  53. package/dist/public/assets/{TimelineDiffPane-DSvFVt40.js → TimelineDiffPane-DDFvXSlv.js} +1 -1
  54. package/dist/public/assets/{agent-diff-store-BX4UT3y1.js → agent-diff-store-jazihC28.js} +1 -1
  55. package/dist/public/assets/{agent-visibility-CYBYXsoR.js → agent-visibility-Ch0XQMkJ.js} +1 -1
  56. package/dist/public/assets/{auth-state-cache-ZZgXmLCf.js → auth-state-cache-D47fide1.js} +2 -2
  57. package/dist/public/assets/{client-version-DN8Gnc8R.js → client-version-CHRlMl4l.js} +1 -1
  58. package/dist/public/assets/{config-context-CdjtvoAz.js → config-context-B2fceTMP.js} +1 -1
  59. package/dist/public/assets/{config-provider-CKct7q_G.js → config-provider-Cb43FIW2.js} +1 -1
  60. package/dist/public/assets/{dist-DIn3VYDc2.js → dist-5ovMzVKN2.js} +1 -1
  61. package/dist/public/assets/{doc-paths-KCjzuC60.js → doc-paths-BFNbv2er.js} +1 -1
  62. package/dist/public/assets/{documents-events-FrlFXuC-.js → documents-events-BM8xyAJz.js} +1 -1
  63. package/dist/public/assets/{file-tree-adapter-BBMHbQG5.js → file-tree-adapter-C1zJK1Gk.js} +1 -1
  64. package/dist/public/assets/{file-tree-utils-DeyBapi2.js → file-tree-utils-Dma5c4k_.js} +1 -1
  65. package/dist/public/assets/{folder-config-api-OU19qNKs.js → folder-config-api-BxuLFuqM.js} +1 -1
  66. package/dist/public/assets/{globals-D4ycChQP.js → globals-DliH2YSL.js} +1 -1
  67. package/dist/public/assets/{index-Bnezs-Zg.js → index-DlH6tzhG.js} +108 -108
  68. package/dist/public/assets/{lint-config-client-D7DpNIwn.js → lint-config-client-DDxBMTZk.js} +1 -1
  69. package/dist/public/assets/{markdownlint-rule-browser-eFxHHf9q.js → markdownlint-rule-browser-c2Uv_5Ry.js} +1 -1
  70. package/dist/public/assets/{navigation-targets-BDSeZX3c.js → navigation-targets-D9VW9WdW.js} +1 -1
  71. package/dist/public/assets/{open-managed-artifact-tab-Wkw7QMir.js → open-managed-artifact-tab-CLwVAGCD.js} +1 -1
  72. package/dist/public/assets/{pending-receive-nav-store-BN0afFCO.js → pending-receive-nav-store-BmcjNZOu.js} +1 -1
  73. package/dist/public/assets/{prop-types-MABP6X1c.js → prop-types-BPmLSxhG.js} +1 -1
  74. package/dist/public/assets/{receive-store-CTNYU3q-.js → receive-store-BlAqmJZT.js} +1 -1
  75. package/dist/public/assets/{selection-context-BgucOSM-.js → selection-context-DJvv-kK_.js} +1 -1
  76. package/dist/public/assets/{skill-actions-By3ZQhYp.js → skill-actions-CfQkZqK6.js} +1 -1
  77. package/dist/public/assets/{skill-scope-DkGQeaIH.js → skill-scope-DwJ84s_r.js} +1 -1
  78. package/dist/public/assets/{skills-api-BCiYKVSk.js → skills-api-BTy9LAk0.js} +1 -1
  79. package/dist/public/assets/{src-C_O1F_4l.js → src-hNXjwMT1.js} +1 -1
  80. package/dist/public/assets/{tag-pill-input-3Bkld5bN.js → tag-pill-input-DVdwNfBT.js} +1 -1
  81. package/dist/public/assets/{target-navigation-intent-BZ8rve8n.js → target-navigation-intent-C6AhTsfc.js} +1 -1
  82. package/dist/public/assets/{terminal-launch-events-DbpTBIvl.js → terminal-launch-events-B1DGOVIv.js} +1 -1
  83. package/dist/public/assets/{terminal-telemetry-BMiT9GUh.js → terminal-telemetry-CviFLmIq.js} +1 -1
  84. package/dist/public/assets/{typing-burst-detector-DDN6b6N7.js → typing-burst-detector-B4AQIJp7.js} +1 -1
  85. package/dist/public/assets/{uninstall-DJBDkbwq.js → uninstall-CfW-qETg.js} +1 -1
  86. package/dist/public/assets/{use-activity-panel-CInEut0L.js → use-activity-panel-D8pDT3xu.js} +1 -1
  87. package/dist/public/assets/{use-collab-url-ecWCytiv.js → use-collab-url-CUHlgRv5.js} +1 -1
  88. package/dist/public/assets/{use-live-xterm-theme-Bf72FxVk.js → use-live-xterm-theme-CLCjRdjJ.js} +1 -1
  89. package/dist/public/assets/{use-open-skill-C3UqDa0B.js → use-open-skill-akwbVkG4.js} +1 -1
  90. package/dist/public/assets/{use-settings-route-CYvmk4XT.js → use-settings-route-BnOIfxuB.js} +1 -1
  91. package/dist/public/assets/{use-skill-directory-Ce1Wy5Qf.js → use-skill-directory-CSx9txvQ.js} +1 -1
  92. package/dist/public/assets/{use-skill-origin-DscI7Fo0.js → use-skill-origin-DvSOmIz_.js} +1 -1
  93. package/dist/public/assets/{use-skills-B19yYlmR.js → use-skills-DcLUuUJ9.js} +1 -1
  94. package/dist/public/assets/{use-terminal-enabled-D556BQSW.js → use-terminal-enabled-CgG0yd-l.js} +1 -1
  95. package/dist/public/assets/{use-timeline-entry-diff-C_2VFthE.js → use-timeline-entry-diff-DD-1OHsM.js} +1 -1
  96. package/dist/public/assets/{use-workspace-008C-zhL.js → use-workspace-J5QvjwOx.js} +1 -1
  97. package/dist/public/index.html +42 -42
  98. package/dist/public/uninstall.html +3 -3
  99. package/dist/{repair-launch-json-BLWZjHxK.mjs → repair-launch-json-DlAJs_pz.mjs} +2 -2
  100. package/dist/{repair-mcp-configs-CTYAl0ua.mjs → repair-mcp-configs-Bg-qmFa_.mjs} +2 -2
  101. package/dist/{repair-skills-BikzcmQr.mjs → repair-skills-CYkvjSVb.mjs} +2 -2
  102. package/dist/repair-skills-R8jaRgSC.mjs +1 -0
  103. package/dist/schemas/v0/config.user.schema.json +10 -1
  104. package/dist/{server-lock-DgWnoftI.mjs → server-lock-CmYdHyX7.mjs} +2 -2
  105. package/dist/server-lock-D61z37T2.mjs +1 -0
  106. package/dist/{sleep-C5OfWWWx.mjs → sleep-jUpHbV7f.mjs} +2 -2
  107. package/dist/{src-Cgpp8Pf-.mjs → src--MxQA4BK.mjs} +2 -2
  108. package/dist/{src-CWDcUomk.mjs → src-2gMaOH-l.mjs} +311 -311
  109. package/dist/{src-CGOjzQCL.mjs → src-B7qPUQHJ.mjs} +1 -1
  110. package/dist/{src-pJ6LEXKc.mjs → src-CHSJwcpc.mjs} +2 -2
  111. package/dist/start-BFzPdz8R.mjs +1 -0
  112. package/dist/{start-TnxpB5de.mjs → start-CszIxyyk.mjs} +3 -3
  113. package/dist/{write-project-skill-B8LGhuHT.mjs → write-project-skill-jk9SeWrA.mjs} +2 -2
  114. package/package.json +5 -5
  115. package/dist/constants-CUaf8eE_.mjs +0 -2
  116. package/dist/fs-traced-CbQ-GS7x.mjs +0 -1
  117. package/dist/git-handle-D0uAjBAd.mjs +0 -1
  118. package/dist/init-D8a-XbzA.mjs +0 -1
  119. package/dist/loader-O6z6lVhP.mjs +0 -1
  120. package/dist/md-manager-CrYbAiKl.mjs +0 -2
  121. package/dist/preview-Bq9cv2G5.mjs +0 -1
  122. package/dist/public/assets/FeedbackForm-FbNH_TYS.js +0 -1
  123. package/dist/public/assets/ManagedArtifactProperties-Ddk1e_f6.js +0 -1
  124. package/dist/repair-skills-CCM2p_7S.mjs +0 -1
  125. package/dist/server-lock-CiN5OJ-t.mjs +0 -1
  126. package/dist/start-tOC8nkMr.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Yt as r,yn as i}from"./DocumentContext-B0g_vd8N.js";import{t as a}from"./react-f2sANaYj.js";import{n as o,r as s}from"./dist-Nvb76hAm.js";import{t as c}from"./useQuery-ZeEDLtxh.js";import{n as l}from"./dist-PQ5KMVDh.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{a as d,c as f,s as p,u as m}from"./terminal-input-events-BGPQuYMh.js";import{t as h}from"./utils-CPqDy6Hr.js";import{i as g,n as _,o as v,s as y,t as b}from"./ChangedOutsideBadge-DVfCTGd2.js";import{t as x}from"./button-RQ5o7P7w.js";import{i as S,n as C,t as w}from"./tooltip-x7BNUa3s.js";import{n as T,r as E,t as D}from"./collapsible-OhEmjTXw.js";import{a as O,c as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dialog-FGMqkFjm.js";import{t as I}from"./checkbox-DoJAOcMt.js";import{a as L,m as R,r as z,t as B}from"./dropdown-menu-AlVJ7dJz.js";import{t as V}from"./label-G0lbYOgL.js";import{i as H,n as ee,o as U,s as te,t as ne}from"./select-BUOcREjn.js";import{i as re,n as W,r as ie,t as G}from"./radio-group-MAC3jHHk.js";import{t as K}from"./switch-BuVbhbtp.js";import{n as q,t as ae}from"./toggle-group-Cnezoq-B.js";import{C as J,a as oe,b as se,c as Y,d as ce,f as le,h as ue,l as de,n as fe,o as pe,r as me,s as he,t as ge,u as _e,y as ve}from"./agent-visibility-CYBYXsoR.js";import{i as ye}from"./terminal-telemetry-BMiT9GUh.js";import{$ as be,$a as xe,Ao as Se,Fo as Ce,Nt as we,Po as Te,Pt as Ee,Qa as De,Qr as Oe,So as ke,To as Ae,Za as je,_a as Me,_o as Ne,co as Pe,do as Fe,fa as Ie,fo as Le,ho as Re,jo as ze,ko as Be,ma as Ve,mt as He,no as Ue,po as We,pr as Ge,to as Ke,yo as qe}from"./dist-DIn3VYDc2.js";import{t as Je}from"./createLucideIcon-DihYAFEK.js";import{a as Ye,c as Xe,d as Ze,s as Qe,t as $e}from"./EnableSyncConfirmDialog-BQttSYlY.js";import{t as et}from"./arrow-up-right-CxtRAecj.js";import{t as tt}from"./RegisteredAgentIcon-H3tp7x07.js";import{t as nt}from"./check-BIbL8Vva.js";import{t as rt}from"./chevron-right-CABnKLlm.js";import{i as it}from"./prop-types-MABP6X1c.js";import{A as at,B as ot,D as st,F as ct,H as lt,M as ut,N as dt,O as ft,P as pt,R as mt,_ as ht,b as gt,c as _t,d as vt,f as yt,h as bt,i as xt,j as St,l as Ct,m as wt,n as Tt,o as Et,p as Dt,u as Ot,v as kt,y as At}from"./auth-state-cache-ZZgXmLCf.js";import{o as jt}from"./folder-config-api-OU19qNKs.js";import{t as Mt}from"./info-BO0f2XRt.js";import{t as Nt}from"./loader-circle-DJ1nzSAL.js";import{c as Pt,i as Ft}from"./field-CmzMDU7U.js";import{t as It}from"./square-pen-DbfX_rTK.js";import{t as Lt}from"./trash-2-WxyktwvM.js";import{t as Rt}from"./triangle-alert-C2yId37R.js";import{t as zt}from"./x-xV4a4mi6.js";import{n as X}from"./dist-uN7pEWl0.js";import{t as Bt}from"./ConfigSharingInfoTooltip-C4ydhukC.js";import{t as Vt}from"./input-Cm94Cun3.js";import{t as Ht}from"./dist-CzC3AWOn.js";import{d as Ut}from"./doc-paths-KCjzuC60.js";import{a as Wt,c as Gt,d as Kt,g as qt,l as Jt,p as Yt,u as Xt}from"./use-settings-route-CYvmk4XT.js";import{K as Zt}from"./navigation-targets-BDSeZX3c.js";import{t as Qt}from"./badge-CAMtyz4F.js";import"./config-provider-CKct7q_G.js";import{a as $t,c as en,d as tn,f as nn,l as rn,n as an,p as on,r as sn,s as cn,u as ln}from"./config-context-CdjtvoAz.js";import{t as un}from"./external-link-Dvu-nzFi.js";import{t as dn}from"./textarea-Cl4IJ1LU.js";import{t as fn}from"./lint-plugin-meta-BxfSlkph.js";import{t as pn}from"./skeleton-Zj40UZU5.js";import{d as mn,n as hn,r as gn,t as _n,u as vn}from"./lint-config-client-D7DpNIwn.js";import{a as yn,d as bn,f as xn,i as Sn,l as Cn,m as wn,o as Tn,p as En,s as Dn,t as On,u as kn}from"./sortable.esm-BuA5-2It.js";import{t as An}from"./open-managed-artifact-tab-Wkw7QMir.js";import{a as jn,f as Mn,i as Nn,n as Pn,o as Fn,p as In,r as Ln,s as Rn,t as zn}from"./form-DJq6IJkN.js";import{t as Bn}from"./tag-pill-input-3Bkld5bN.js";import{t as Vn}from"./markdownlint-rule-browser-eFxHHf9q.js";import{i as Hn,n as Un}from"./schema-fields-view-intent-DVVFEaIP.js";import{n as Wn,t as Gn}from"./use-terminal-enabled-D556BQSW.js";var Kn=Je(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=u(),Q=e(a(),1),$=n(),qn=`settings-sharing-title`;function Jn(){let e=(0,Z.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)(Yn,{}):(0,$.jsx)(Xn,{}),e[0]=n):n=e[0],n}function Yn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:qn,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`cs4mps`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":qn,className:`space-y-3`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function Xn(){let e=(0,Z.c)(39),{_:t}=s(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u;e[0]===t?u=e[1]:(u=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r(Qn)}},e[0]=t,e[1]=u);let d=u,f;e[2]===d?f=e[3]:(f=()=>{d()},e[2]=d,e[3]=f);let p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],e[4]=p):p=e[4],(0,Q.useEffect)(f,p);let m;e[5]!==t||e[6]!==i||e[7]!==d||e[8]!==n?(m=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),l(null);let o=null,s=null;try{o=await r.setMode(e)}catch(e){s=e}if(a(!1),s!==null){X.error(s instanceof Error?s.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(l({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`wdzBgi`}:{id:`k_pade`})),await d())},e[5]=t,e[6]=i,e[7]=d,e[8]=n,e[9]=m):m=e[9];let h=m,g;e[10]!==t||e[11]!==i||e[12]!==d||e[13]!==n?(g=async function(){let e=window.okDesktop?.sharing;if(!e||n===null||i)return;a(!0);let r=null,o=null;try{r=await e.setSkillsShared(!1)}catch(e){o=e}if(a(!1),o!==null){X.error(o instanceof Error?o.message:t({id:`onTlRk`}));return}if(r!==null){if(r.kind===`no-exclude`){let e=r.reason===`no-git`?t({id:`Xwump4`}):r.reason===`inaccessible`?t({id:`PlGC6r`}):t({id:`zcmYx4`});X.warning(t({id:`4h3e0H`,values:{detail:e}}));return}X.success(t({id:`P3S14k`})),await d()}},e[10]=t,e[11]=i,e[12]=d,e[13]=n,e[14]=g):g=e[14];let _=g;if(n===null){let t;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":qn,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:qn,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`cs4mps`})}),(0,$.jsx)(pn,{className:`h-24`})]}),e[15]=t):t=e[15],t}let v=n.mode===`no-git`,y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:qn,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`cs4mps`})}),(0,$.jsx)(Bt,{})]}),e[16]=y):y=e[16];let b;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[y,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`N55YNr`})})]}),e[17]=b):b=e[17];let S;e[18]!==i||e[19]!==v||e[20]!==h||e[21]!==n.mode?(S=v?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(o,{id:`ju38ms`})}):(0,$.jsxs)(G,{value:n.mode,onValueChange:e=>void h(e),disabled:i,className:`gap-2`,"aria-labelledby":qn,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(W,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(o,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(W,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(o,{id:`QjzFZj`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`un-K1H`})})]})]})]}),e[18]=i,e[19]=v,e[20]=h,e[21]=n.mode,e[22]=S):S=e[22];let C;e[23]!==i||e[24]!==_||e[25]!==n.mode||e[26]!==n.skillsShared?(C=n.mode===`local-only`&&n.skillsShared?(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-skills-exception`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(o,{id:`Kiytqd`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`K0FgsP`})})]}),(0,$.jsx)(x,{variant:`outline`,size:`sm`,disabled:i,onClick:()=>void _(),children:(0,$.jsx)(o,{id:`9uI_rE`})})]}):null,e[23]=i,e[24]=_,e[25]=n.mode,e[26]=n.skillsShared,e[27]=C):C=e[27];let w;e[28]===c?w=e[29]:(w=c===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(o,{id:`ZscwQ0`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:c.remediation}),(0,$.jsx)(x,{variant:`outline`,size:`sm`,onClick:()=>l(null),children:(0,$.jsx)(o,{id:`1QfxQT`})})]}),e[28]=c,e[29]=w);let T;e[30]!==c||e[31]!==n.mode||e[32]!==n.trackedUpstream?(T=n.trackedUpstream.length>0&&n.mode!==`no-git`&&c===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(o,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(Zn)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[30]=c,e[31]=n.mode,e[32]=n.trackedUpstream,e[33]=T):T=e[33];let E;return e[34]!==T||e[35]!==S||e[36]!==C||e[37]!==w?(E=(0,$.jsxs)(`section`,{"aria-labelledby":qn,className:`space-y-4`,"data-testid":`settings-sharing`,children:[b,S,C,w,T]}),e[34]=T,e[35]=S,e[36]=C,e[37]=w,e[38]=E):E=e[38],E}function Zn(e){return(0,$.jsx)(`li`,{children:e},e)}function Qn(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[],skillsShared:!1}}function $n(e){let t=(0,Z.c)(35),{authQueryTransport:n,authTransport:r}=e,{_:i}=s(),a;t[0]===n?a=t[1]:(a=n??mt(),t[0]=n,t[1]=a);let c=a,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l={phase:`loading`},t[2]=l):l=t[2];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),v=(0,Q.useRef)(!1),y;t[3]===c?y=t[4]:(y=async function(){d({phase:`loading`});try{let e=await c.status();d({phase:`loaded`,result:e}),Tt(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),d({phase:`check-failed`})}},t[3]=c,t[4]=y);let b=y,S;t[5]===b?S=t[6]:(S=()=>{b()},t[5]=b,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[7]=C):C=t[7],(0,Q.useEffect)(S,C);let w;t[8]!==i||t[9]!==b||t[10]!==c?(w=async function(){if(v.current)return;v.current=!0,p(!1),h(!0),_(null);let e=null;try{let t=c.signout?await c.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&_(e),h(!1),v.current=!1},t[8]=i,t[9]=b,t[10]=c,t[11]=w):w=t[11];let T=w,E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(`h3`,{id:`settings-account-title`,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`AeXO77`})}),t[12]=E):E=t[12];let D;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[E,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`E6lrpp`})})]}),t[13]=D):D=t[13];let O;t[14]!==g||t[15]!==m||t[16]!==T||t[17]!==b||t[18]!==u.phase||t[19]!==u.result?(O=u.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(o,{id:`IWGfGF`})}),(0,$.jsx)(pn,{className:`h-4 w-40`}),(0,$.jsx)(pn,{className:`h-8 w-32`})]}):u.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`T_wG4n`})}),(0,$.jsx)(x,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(o,{id:`KDw4GX`})})]}):u.result.authenticated?u.result.tier===`A`?(0,$.jsx)(tr,{login:u.result.login}):(0,$.jsx)(er,{login:u.result.login,disconnecting:m,error:g,onDisconnect:()=>void T()}):(0,$.jsx)(nr,{onConnect:()=>p(!0)}),t[14]=g,t[15]=m,t[16]=T,t[17]=b,t[18]=u.phase,t[19]=u.result,t[20]=O):O=t[20];let k;t[21]===b?k=t[22]:(k=e=>{p(e),e||b()},t[21]=b,t[22]=k);let A=u.phase===`loaded`?u.result.host:void 0,j=u.phase===`loaded`?u.result.ghAvailable:void 0,M;t[23]===b?M=t[24]:(M=()=>{b()},t[23]=b,t[24]=M);let N;t[25]!==f||t[26]!==r||t[27]!==k||t[28]!==A||t[29]!==j||t[30]!==M?(N=(0,$.jsx)(ct,{open:f,onOpenChange:k,transport:r,host:A,ghAvailable:j,onSuccess:M}),t[25]=f,t[26]=r,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==N||t[33]!==O?(P=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,N]}),t[32]=N,t[33]=O,t[34]=P):P=t[34],P}function er(e){let t=(0,Z.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(o,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(o,{id:`nxlOpL`})}),t[2]=c):c=t[2];let l;t[3]===s?l=t[4]:(l=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[3]=s,t[4]=l);let u;t[5]===r?u=t[6]:(u=r?(0,$.jsx)(o,{id:`rppgXF`}):(0,$.jsx)(o,{id:`-K0AvT`}),t[5]=r,t[6]=u);let d;t[7]!==r||t[8]!==a||t[9]!==u?(d=(0,$.jsx)(x,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:u}),t[7]=r,t[8]=a,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(o,{id:`msOK6I`})}),t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=m);let h;return t[17]!==f||t[18]!==m?(h=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[f,p,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19],h}function tr(e){let t=(0,Z.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(o,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(o,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function nr(e){let t=(0,Z.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(o,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(o,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(o,{id:`5lWFkC`}),t[2]=a):a=t[2];let s;return t[3]===n?s=t[4]:(s=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(x,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=s),s}function rr(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function ir(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=s(),a;t[0]===i?a=t[1]:(a=i({id:`2B6eYX`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Mt,{className:`size-3.5`}),t[2]=o):o=t[2];let c;t[3]!==a||t[4]!==n?(c=(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(x,{variant:`ghost`,size:`icon`,className:`mt-1.5 mr-1.5 h-6 w-6 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,"aria-label":a,"data-testid":n,children:o})}),t[3]=a,t[4]=n,t[5]=c):c=t[5];let l;t[6]===r?l=t[7]:(l=(0,$.jsx)(C,{side:`left`,className:`max-w-sm text-left`,children:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:r})}),t[6]=r,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,$.jsxs)(w,{children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function ar(){let e=(0,Z.c)(38),{_:t}=s(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{if(!n)return;let e=!1;return n.integrations.status().then(t=>{e||i(t)}).catch(()=>{e||c(!0)}),()=>{e=!0}},f=[n],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=async function(e,r){if(n){u(rr(e));try{let t=await n.integrations.setComponent({component:e,enabled:r});i(t.status),t.ok||X.error(t.error)}catch(e){let n=e;X.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}u(null)}},e[2]=t,e[3]=p);let m=p,h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`h3`,{id:`settings-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`_5qBNl`})}),e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`mLAjyL`})})]}),e[5]=g):g=e[5];let _=g;if(!n||a){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[_,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(o,{id:`O4PnDd`})})]}),e[6]=t):t=e[6],t}if(r===null){let t;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[_,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(pn,{className:`h-10 w-full`}),(0,$.jsx)(pn,{className:`h-10 w-full`}),(0,$.jsx)(pn,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}let v=l!==null||!r.available,y=r.path.shellDetected||r.path.installed,b;e[8]===r.available?b=e[9]:(b=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`ai-tools-read-only`,children:(0,$.jsx)(o,{id:`OplnBG`})}),e[8]=r.available,e[9]=b);let x;e[10]!==t||e[11]!==m||e[12]!==v||e[13]!==y||e[14]!==r.path.installed||e[15]!==r.path.rcFilesToTouch?(x=y&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(o,{id:`ALhMYW`})}),(0,$.jsxs)(`div`,{className:`flex items-start overflow-hidden rounded-md border border-border bg-card/50 hover:bg-accent`,children:[(0,$.jsxs)(V,{htmlFor:`ai-tools-path`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(I,{id:`ai-tools-path`,checked:r.path.installed,disabled:v,onCheckedChange:()=>void m({kind:`path`},!r.path.installed),className:`mt-0.5`,"data-testid":`ai-tools-path-checkbox`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(o,{id:`Fsx78O`,components:{0:(0,$.jsx)(`code`,{className:`inline-code`})}})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-path-status`,children:r.path.installed?t({id:`yhdqox`}):t({id:`04XyCH`,values:{0:r.path.rcFilesToTouch.join(`, `)}})})]})]}),(0,$.jsxs)(ir,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(o,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map(sr),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(o,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[10]=t,e[11]=m,e[12]=v,e[13]=y,e[14]=r.path.installed,e[15]=r.path.rcFilesToTouch,e[16]=x):x=e[16];let S;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(o,{id:`psfGPX`})}),e[17]=S):S=e[17];let C;if(e[18]!==t||e[19]!==m||e[20]!==v||e[21]!==r.editors){let n;e[23]!==t||e[24]!==m||e[25]!==v?(n=e=>{let n=e.state===`installed`||e.state===`foreign`,r=v||e.state===`unmanageable`,i=e.state===`not-installed`&&!e.detected,a=`https://openknowledge.ai/docs/integrations/${Me[e.id]}`,s=e.state===`installed`?t({id:`eQkgKV`}):e.state===`foreign`?t({id:`AczYxH`}):e.state===`unmanageable`?t({id:`LbmLyU`}):e.detected?t({id:`bBE5tC`}):null,c=e.state===`foreign`||e.state===`unmanageable`?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,$.jsxs)(`li`,{className:r?`flex items-start`:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(V,{htmlFor:`ai-tools-editor-${e.id}`,className:r?`flex flex-1 items-start gap-2.5 px-3 py-2.5 font-normal`:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(I,{id:`ai-tools-editor-${e.id}`,checked:n,disabled:r,onCheckedChange:()=>void m({kind:`editor`,id:e.id},!n),className:`mt-0.5`,"data-testid":`ai-tools-editor-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.label}),s!==null&&(0,$.jsx)(`span`,{className:c,"data-testid":`ai-tools-editor-status-${e.id}`,children:s})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>un(e,a),onAuxClick:e=>un(e,a),"aria-label":t({id:`D-Oh1s`,values:{0:e.label}}),className:`flex shrink-0 items-center gap-0.5 px-2 py-2.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`ai-tools-editor-status-${e.id}`,children:[(0,$.jsx)(o,{id:`P_bX4O`}),(0,$.jsx)(et,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(ir,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(o,{id:`J2eKUI`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.configPath??t({id:`ndwmea`})})}),(0,$.jsx)(`p`,{className:`pt-1 opacity-70`,children:(0,$.jsx)(o,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[23]=t,e[24]=m,e[25]=v,e[26]=n):n=e[26],C=r.editors.map(n),e[18]=t,e[19]=m,e[20]=v,e[21]=r.editors,e[22]=C}else C=e[22];let w;e[27]===C?w=e[28]:(w=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[S,(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:C})]}),e[27]=C,e[28]=w);let T;e[29]!==m||e[30]!==v||e[31]!==r.skills?(T=r.skills.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(o,{id:`28B21t`})}),(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:r.skills.map(e=>(0,$.jsxs)(`li`,{className:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(V,{htmlFor:`ai-tools-skill-${e.id}`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(I,{id:`ai-tools-skill-${e.id}`,checked:e.installed,disabled:v,onCheckedChange:()=>void m({kind:`skill`,id:e.id},!e.installed),className:`mt-0.5`,"data-testid":`ai-tools-skill-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(`code`,{children:e.name})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-skill-status-${e.id}`,children:e.id===`discovery`?(0,$.jsx)(o,{id:`0inVGS`}):(0,$.jsx)(o,{id:`FXk_zY`})})]})]}),(0,$.jsxs)(ir,{testId:`ai-tools-skill-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(o,{id:`HSh8u_`})}),e.paths.map(or)]})]},e.id))})]}),e[29]=m,e[30]=v,e[31]=r.skills,e[32]=T):T=e[32];let E;return e[33]!==T||e[34]!==b||e[35]!==x||e[36]!==w?(E=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[_,b,x,w,T]}),e[33]=T,e[34]=b,e[35]=x,e[36]=w,e[37]=E):E=e[37],E}function or(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function sr(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function cr(e){return{chrome:e.sidebar,surface:e.background,bar:e.primary,line:e.border,dots:[e[`syntax-string`],e[`syntax-keyword`],e[`syntax-atom`]]}}function lr(e,t,n){return e.id===`custom`?cr(Fe(on(t))):e.scheme?cr(Fe(e.scheme)):cr(ln(n))}function ur(e){let t=(0,Z.c)(36),{theme:n,customSeed:r,defaultMode:i}=e,a,o,s,c,l,u,d,f,p;t[0]!==r||t[1]!==i||t[2]!==n?(a=lr(n,r,i),u=!0,d=`aspect-[4/3] w-full overflow-hidden rounded-md border`,f={backgroundColor:a.surface,borderColor:a.line},p=(0,$.jsxs)(`div`,{className:`flex h-1/3 items-center gap-1 px-1.5`,style:{backgroundColor:a.chrome,borderBottom:`1px solid ${a.line}`},children:[(0,$.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{backgroundColor:a.bar}}),(0,$.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full opacity-50`,style:{backgroundColor:a.line}})]}),l=`flex h-2/3`,o=`flex w-1/4 flex-col items-center justify-center gap-1`,s={backgroundColor:a.chrome,borderRight:`1px solid ${a.line}`},c=a.dots.map(dr),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p):(a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11]);let m;t[12]!==o||t[13]!==s||t[14]!==c?(m=(0,$.jsx)(`div`,{className:o,style:s,children:c}),t[12]=o,t[13]=s,t[14]=c,t[15]=m):m=t[15];let h;t[16]===a.dots[1]?h=t[17]:(h=(0,$.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-full`,style:{backgroundColor:a.dots[1]}}),t[16]=a.dots[1],t[17]=h);let g;t[18]===a.line?g=t[19]:(g=(0,$.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-full opacity-60`,style:{backgroundColor:a.line}}),t[18]=a.line,t[19]=g);let _;t[20]===a.dots[0]?_=t[21]:(_=(0,$.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-full`,style:{backgroundColor:a.dots[0]}}),t[20]=a.dots[0],t[21]=_);let v;t[22]!==h||t[23]!==g||t[24]!==_?(v=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1 px-1.5`,children:[h,g,_]}),t[22]=h,t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==v||t[27]!==l||t[28]!==m?(y=(0,$.jsxs)(`div`,{className:l,children:[m,v]}),t[26]=v,t[27]=l,t[28]=m,t[29]=y):y=t[29];let b;return t[30]!==y||t[31]!==u||t[32]!==d||t[33]!==f||t[34]!==p?(b=(0,$.jsxs)(`div`,{"aria-hidden":u,className:d,style:f,children:[p,y]}),t[30]=y,t[31]=u,t[32]=d,t[33]=f,t[34]=p,t[35]=b):b=t[35],b}function dr(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function fr(e){let t=(0,Z.c)(11),{value:n,onSelect:r,customSeed:i,defaultMode:a,id:o,"aria-label":c,"aria-describedby":l}=e,u=a===void 0?`light`:a,{_:d}=s(),f=Pe.some(e=>e.id===n)?n:`default`,p;t[0]!==d||t[1]!==i||t[2]!==u?(p=Pe.map(e=>(0,$.jsxs)(ie,{value:e.id,className:h(`group/tile flex flex-col gap-1.5 rounded-lg border-2 border-transparent p-1 text-left outline-none`,`hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40`,`data-checked:border-primary`),children:[(0,$.jsx)(ur,{theme:e,customSeed:i,defaultMode:u}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-0.5`,children:[(0,$.jsx)(`span`,{className:`text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.id===`custom`?en(on(i))===`dark`?d({id:`pvnfJD`}):d({id:`1njn7W`}):e.kind===`system`?d({id:`R9Khdg`}):e.kind===`light`?d({id:`1njn7W`}):d({id:`pvnfJD`})})]})]},e.id)),t[0]=d,t[1]=i,t[2]=u,t[3]=p):p=t[3];let m;return t[4]!==l||t[5]!==c||t[6]!==o||t[7]!==r||t[8]!==f||t[9]!==p?(m=(0,$.jsx)(re,{id:o,"aria-label":c,"aria-describedby":l,value:f,onValueChange:r,className:`grid w-full grid-cols-2 gap-2 sm:grid-cols-3`,children:p}),t[4]=l,t[5]=c,t[6]=o,t[7]=r,t[8]=f,t[9]=p,t[10]=m):m=t[10],m}function pr(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:pr(r,t)}}function mr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function hr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function gr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}function _r(e){if(!ke(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function vr(){let e=(0,Z.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(pn,{className:`h-5 w-32`}),n=(0,$.jsx)(pn,{className:`h-4 w-64`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[t,n,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(pn,{className:`h-9 w-full`}),(0,$.jsx)(pn,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function yr({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=s(),a=In(),c=Te(xe,e.path),l=c?hr(c):void 0,u=c?mr(c):void 0,d=c?gr(c):void 0,f=c?Ne(c):void 0,p=f?.scope===`project`&&t!==`project`||f?.scope===`user`&&t!==`user`,m=e.path.join(`.`),g=i(e.label),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{y.current&&clearTimeout(y.current)},[]);let b=()=>{v(!0),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>v(!1),1200)},T=()=>{let e=n(m);return e&&b(),e},E=()=>a.getFieldState(m).isDirty?T():!0,D=()=>{let e=u===void 0?null:u;a.setValue(m,e,{shouldDirty:!1}),T()},O=h(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(Nn,{control:a.control,name:m,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(jn,{className:O,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(Fn,{className:`text-sm font-medium`,children:g}),r?(0,$.jsxs)(w,{children:[(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:D,"aria-label":i({id:`lhjq3G`,values:{labelText:g}}),children:(0,$.jsx)(Pt,{className:`size-3.5`})})}),(0,$.jsx)(C,{children:(0,$.jsx)(o,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(Ln,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Pn,{children:(0,$.jsx)(br,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:E})}),(0,$.jsx)(wr,{visible:_,srOnly:e.control===`theme-tiles`})]}),(0,$.jsx)(Rn,{"data-field-error":e.path.join(`.`)})]})}})}function br({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";let{_:o}=s(),{setTheme:c,systemTheme:u}=l(),d=sn()?.merged??null;if(e.control===`theme-tiles`){let{id:n,...r}=a,s=d?.appearance?.customTheme,l=d?.appearance?.theme,f=l===`light`||l===`dark`?l:u===`dark`?`dark`:`light`;return(0,$.jsx)(fr,{...r,id:n,value:typeof t.value==`string`?t.value:`default`,customSeed:s,defaultMode:f,"aria-label":o(e.label),onSelect:e=>{if($t(e,s),e===`custom`)c(en(on(s))===`dark`?`dark`:`light`);else{let t=Re(e);t&&c(t)}t.onChange(e),i()}})}if(n===`boolean`)return(0,$.jsx)(K,{...a,checked:!!t.value,ref:t.ref,onCheckedChange:e=>{t.onChange(e),i()},onBlur:t.onBlur});if(n===`enum`&&r&&r.length>0&&(e.control===`enum-toggle`||r.length<=4)){let{id:n,...s}=a,l=e.path[0]===`appearance`&&e.path[1]===`theme`;return(0,$.jsx)(ae,{...s,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{e&&(l&&c(e),t.onChange(e),i())},onBlur:t.onBlur,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":o(e.label),children:r.map((e,t)=>(0,$.jsx)(q,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Sr,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(Cr,{ctl:t,onCommit:i,...a}):(0,$.jsx)(xr,{ctl:t,onCommit:i,...a})}function xr({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Vt,{...n,value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),t()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t())},className:`h-8 text-sm`})}function Sr({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Q.useState)(e.value===void 0?``:String(e.value)),a=(0,Q.useRef)(e.value);(0,Q.useEffect)(()=>{a.current!==e.value&&(i(e.value===void 0?``:String(e.value)),a.current=e.value)},[e.value]);let o=()=>{let n=Number(r);if(!Number.isFinite(n)){e.onChange(r),t();return}e.onChange(n),t(),a.current=n};return(0,$.jsx)(Vt,{...n,type:`number`,value:r,ref:e.ref,onChange:e=>i(e.target.value),onBlur:()=>{e.onBlur(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},className:`h-8 w-28 text-sm tabular-nums`})}function Cr({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
1
+ import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Yt as r,yn as i}from"./DocumentContext-DD95gIt4.js";import{t as a}from"./react-f2sANaYj.js";import{n as o,r as s}from"./dist-Nvb76hAm.js";import{t as c}from"./useQuery-ZeEDLtxh.js";import{n as l}from"./dist-PQ5KMVDh.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{a as d,c as f,s as p,u as m}from"./terminal-input-events-BGPQuYMh.js";import{t as h}from"./utils-CPqDy6Hr.js";import{i as g,n as _,o as v,s as y,t as b}from"./ChangedOutsideBadge-eT1ODdAD.js";import{t as x}from"./button-RQ5o7P7w.js";import{i as S,n as C,t as w}from"./tooltip-x7BNUa3s.js";import{n as T,r as E,t as D}from"./collapsible-OhEmjTXw.js";import{a as O,c as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dialog-FGMqkFjm.js";import{t as I}from"./checkbox-DoJAOcMt.js";import{a as L,m as R,r as z,t as B}from"./dropdown-menu-AlVJ7dJz.js";import{t as V}from"./label-G0lbYOgL.js";import{i as H,n as ee,o as U,s as te,t as ne}from"./select-BUOcREjn.js";import{i as re,n as W,r as ie,t as G}from"./radio-group-MAC3jHHk.js";import{t as K}from"./switch-BuVbhbtp.js";import{n as q,t as ae}from"./toggle-group-Cnezoq-B.js";import{C as J,a as oe,b as se,c as Y,d as ce,f as le,h as ue,l as de,n as fe,o as pe,r as me,s as he,t as ge,u as _e,y as ve}from"./agent-visibility-Ch0XQMkJ.js";import{i as ye}from"./terminal-telemetry-CviFLmIq.js";import{$ as be,$a as xe,Ao as Se,Fo as Ce,Nt as we,Po as Te,Pt as Ee,Qa as De,Qr as Oe,So as ke,To as Ae,Za as je,_a as Me,_o as Ne,co as Pe,do as Fe,fa as Ie,fo as Le,ho as Re,jo as ze,ko as Be,ma as Ve,mt as He,no as Ue,po as We,pr as Ge,to as Ke,yo as qe}from"./dist-5ovMzVKN2.js";import{t as Je}from"./createLucideIcon-DihYAFEK.js";import{a as Ye,c as Xe,d as Ze,s as Qe,t as $e}from"./EnableSyncConfirmDialog-C5fNw26t.js";import{t as et}from"./arrow-up-right-CxtRAecj.js";import{t as tt}from"./RegisteredAgentIcon-H3tp7x07.js";import{t as nt}from"./check-BIbL8Vva.js";import{t as rt}from"./chevron-right-CABnKLlm.js";import{i as it}from"./prop-types-BPmLSxhG.js";import{A as at,B as ot,D as st,F as ct,H as lt,M as ut,N as dt,O as ft,P as pt,R as mt,_ as ht,b as gt,c as _t,d as vt,f as yt,h as bt,i as xt,j as St,l as Ct,m as wt,n as Tt,o as Et,p as Dt,u as Ot,v as kt,y as At}from"./auth-state-cache-D47fide1.js";import{o as jt}from"./folder-config-api-BxuLFuqM.js";import{t as Mt}from"./info-BO0f2XRt.js";import{t as Nt}from"./loader-circle-DJ1nzSAL.js";import{c as Pt,i as Ft}from"./field-CmzMDU7U.js";import{t as It}from"./square-pen-DbfX_rTK.js";import{t as Lt}from"./trash-2-WxyktwvM.js";import{t as Rt}from"./triangle-alert-C2yId37R.js";import{t as zt}from"./x-xV4a4mi6.js";import{n as X}from"./dist-uN7pEWl0.js";import{t as Bt}from"./ConfigSharingInfoTooltip-C4ydhukC.js";import{t as Vt}from"./input-Cm94Cun3.js";import{t as Ht}from"./dist-CzC3AWOn.js";import{d as Ut}from"./doc-paths-BFNbv2er.js";import{a as Wt,c as Gt,d as Kt,g as qt,l as Jt,p as Yt,u as Xt}from"./use-settings-route-BnOIfxuB.js";import{K as Zt}from"./navigation-targets-D9VW9WdW.js";import{t as Qt}from"./badge-CAMtyz4F.js";import"./config-provider-Cb43FIW2.js";import{a as $t,c as en,d as tn,f as nn,l as rn,n as an,p as on,r as sn,s as cn,u as ln}from"./config-context-B2fceTMP.js";import{t as un}from"./external-link-Dvu-nzFi.js";import{t as dn}from"./textarea-Cl4IJ1LU.js";import{t as fn}from"./lint-plugin-meta-BxfSlkph.js";import{t as pn}from"./skeleton-Zj40UZU5.js";import{d as mn,n as hn,r as gn,t as _n,u as vn}from"./lint-config-client-DDxBMTZk.js";import{a as yn,d as bn,f as xn,i as Sn,l as Cn,m as wn,o as Tn,p as En,s as Dn,t as On,u as kn}from"./sortable.esm-BuA5-2It.js";import{t as An}from"./open-managed-artifact-tab-CLwVAGCD.js";import{a as jn,f as Mn,i as Nn,n as Pn,o as Fn,p as In,r as Ln,s as Rn,t as zn}from"./form-DJq6IJkN.js";import{t as Bn}from"./tag-pill-input-DVdwNfBT.js";import{t as Vn}from"./markdownlint-rule-browser-c2Uv_5Ry.js";import{i as Hn,n as Un}from"./schema-fields-view-intent-DVVFEaIP.js";import{n as Wn,t as Gn}from"./use-terminal-enabled-CgG0yd-l.js";var Kn=Je(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=u(),Q=e(a(),1),$=n(),qn=`settings-sharing-title`;function Jn(){let e=(0,Z.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)(Yn,{}):(0,$.jsx)(Xn,{}),e[0]=n):n=e[0],n}function Yn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:qn,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`cs4mps`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":qn,className:`space-y-3`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[t,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function Xn(){let e=(0,Z.c)(39),{_:t}=s(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u;e[0]===t?u=e[1]:(u=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r(Qn)}},e[0]=t,e[1]=u);let d=u,f;e[2]===d?f=e[3]:(f=()=>{d()},e[2]=d,e[3]=f);let p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],e[4]=p):p=e[4],(0,Q.useEffect)(f,p);let m;e[5]!==t||e[6]!==i||e[7]!==d||e[8]!==n?(m=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),l(null);let o=null,s=null;try{o=await r.setMode(e)}catch(e){s=e}if(a(!1),s!==null){X.error(s instanceof Error?s.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(l({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`wdzBgi`}:{id:`k_pade`})),await d())},e[5]=t,e[6]=i,e[7]=d,e[8]=n,e[9]=m):m=e[9];let h=m,g;e[10]!==t||e[11]!==i||e[12]!==d||e[13]!==n?(g=async function(){let e=window.okDesktop?.sharing;if(!e||n===null||i)return;a(!0);let r=null,o=null;try{r=await e.setSkillsShared(!1)}catch(e){o=e}if(a(!1),o!==null){X.error(o instanceof Error?o.message:t({id:`onTlRk`}));return}if(r!==null){if(r.kind===`no-exclude`){let e=r.reason===`no-git`?t({id:`Xwump4`}):r.reason===`inaccessible`?t({id:`PlGC6r`}):t({id:`zcmYx4`});X.warning(t({id:`4h3e0H`,values:{detail:e}}));return}X.success(t({id:`P3S14k`})),await d()}},e[10]=t,e[11]=i,e[12]=d,e[13]=n,e[14]=g):g=e[14];let _=g;if(n===null){let t;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":qn,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:qn,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`cs4mps`})}),(0,$.jsx)(pn,{className:`h-24`})]}),e[15]=t):t=e[15],t}let v=n.mode===`no-git`,y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:qn,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`cs4mps`})}),(0,$.jsx)(Bt,{})]}),e[16]=y):y=e[16];let b;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[y,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`N55YNr`})})]}),e[17]=b):b=e[17];let S;e[18]!==i||e[19]!==v||e[20]!==h||e[21]!==n.mode?(S=v?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(o,{id:`ju38ms`})}):(0,$.jsxs)(G,{value:n.mode,onValueChange:e=>void h(e),disabled:i,className:`gap-2`,"aria-labelledby":qn,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(W,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(o,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(W,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(o,{id:`QjzFZj`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`un-K1H`})})]})]})]}),e[18]=i,e[19]=v,e[20]=h,e[21]=n.mode,e[22]=S):S=e[22];let C;e[23]!==i||e[24]!==_||e[25]!==n.mode||e[26]!==n.skillsShared?(C=n.mode===`local-only`&&n.skillsShared?(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-skills-exception`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(o,{id:`Kiytqd`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`K0FgsP`})})]}),(0,$.jsx)(x,{variant:`outline`,size:`sm`,disabled:i,onClick:()=>void _(),children:(0,$.jsx)(o,{id:`9uI_rE`})})]}):null,e[23]=i,e[24]=_,e[25]=n.mode,e[26]=n.skillsShared,e[27]=C):C=e[27];let w;e[28]===c?w=e[29]:(w=c===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(o,{id:`ZscwQ0`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:c.remediation}),(0,$.jsx)(x,{variant:`outline`,size:`sm`,onClick:()=>l(null),children:(0,$.jsx)(o,{id:`1QfxQT`})})]}),e[28]=c,e[29]=w);let T;e[30]!==c||e[31]!==n.mode||e[32]!==n.trackedUpstream?(T=n.trackedUpstream.length>0&&n.mode!==`no-git`&&c===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(o,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(Zn)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[30]=c,e[31]=n.mode,e[32]=n.trackedUpstream,e[33]=T):T=e[33];let E;return e[34]!==T||e[35]!==S||e[36]!==C||e[37]!==w?(E=(0,$.jsxs)(`section`,{"aria-labelledby":qn,className:`space-y-4`,"data-testid":`settings-sharing`,children:[b,S,C,w,T]}),e[34]=T,e[35]=S,e[36]=C,e[37]=w,e[38]=E):E=e[38],E}function Zn(e){return(0,$.jsx)(`li`,{children:e},e)}function Qn(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[],skillsShared:!1}}function $n(e){let t=(0,Z.c)(35),{authQueryTransport:n,authTransport:r}=e,{_:i}=s(),a;t[0]===n?a=t[1]:(a=n??mt(),t[0]=n,t[1]=a);let c=a,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l={phase:`loading`},t[2]=l):l=t[2];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),v=(0,Q.useRef)(!1),y;t[3]===c?y=t[4]:(y=async function(){d({phase:`loading`});try{let e=await c.status();d({phase:`loaded`,result:e}),Tt(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),d({phase:`check-failed`})}},t[3]=c,t[4]=y);let b=y,S;t[5]===b?S=t[6]:(S=()=>{b()},t[5]=b,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[7]=C):C=t[7],(0,Q.useEffect)(S,C);let w;t[8]!==i||t[9]!==b||t[10]!==c?(w=async function(){if(v.current)return;v.current=!0,p(!1),h(!0),_(null);let e=null;try{let t=c.signout?await c.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&_(e),h(!1),v.current=!1},t[8]=i,t[9]=b,t[10]=c,t[11]=w):w=t[11];let T=w,E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(`h3`,{id:`settings-account-title`,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`AeXO77`})}),t[12]=E):E=t[12];let D;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[E,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`E6lrpp`})})]}),t[13]=D):D=t[13];let O;t[14]!==g||t[15]!==m||t[16]!==T||t[17]!==b||t[18]!==u.phase||t[19]!==u.result?(O=u.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(o,{id:`IWGfGF`})}),(0,$.jsx)(pn,{className:`h-4 w-40`}),(0,$.jsx)(pn,{className:`h-8 w-32`})]}):u.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`T_wG4n`})}),(0,$.jsx)(x,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(o,{id:`KDw4GX`})})]}):u.result.authenticated?u.result.tier===`A`?(0,$.jsx)(tr,{login:u.result.login}):(0,$.jsx)(er,{login:u.result.login,disconnecting:m,error:g,onDisconnect:()=>void T()}):(0,$.jsx)(nr,{onConnect:()=>p(!0)}),t[14]=g,t[15]=m,t[16]=T,t[17]=b,t[18]=u.phase,t[19]=u.result,t[20]=O):O=t[20];let k;t[21]===b?k=t[22]:(k=e=>{p(e),e||b()},t[21]=b,t[22]=k);let A=u.phase===`loaded`?u.result.host:void 0,j=u.phase===`loaded`?u.result.ghAvailable:void 0,M;t[23]===b?M=t[24]:(M=()=>{b()},t[23]=b,t[24]=M);let N;t[25]!==f||t[26]!==r||t[27]!==k||t[28]!==A||t[29]!==j||t[30]!==M?(N=(0,$.jsx)(ct,{open:f,onOpenChange:k,transport:r,host:A,ghAvailable:j,onSuccess:M}),t[25]=f,t[26]=r,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==N||t[33]!==O?(P=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,N]}),t[32]=N,t[33]=O,t[34]=P):P=t[34],P}function er(e){let t=(0,Z.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(o,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(o,{id:`nxlOpL`})}),t[2]=c):c=t[2];let l;t[3]===s?l=t[4]:(l=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[3]=s,t[4]=l);let u;t[5]===r?u=t[6]:(u=r?(0,$.jsx)(o,{id:`rppgXF`}):(0,$.jsx)(o,{id:`-K0AvT`}),t[5]=r,t[6]=u);let d;t[7]!==r||t[8]!==a||t[9]!==u?(d=(0,$.jsx)(x,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:u}),t[7]=r,t[8]=a,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(o,{id:`msOK6I`})}),t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=m);let h;return t[17]!==f||t[18]!==m?(h=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[f,p,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19],h}function tr(e){let t=(0,Z.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(o,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(o,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function nr(e){let t=(0,Z.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(o,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(o,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(o,{id:`5lWFkC`}),t[2]=a):a=t[2];let s;return t[3]===n?s=t[4]:(s=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(x,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=s),s}function rr(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function ir(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=s(),a;t[0]===i?a=t[1]:(a=i({id:`2B6eYX`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Mt,{className:`size-3.5`}),t[2]=o):o=t[2];let c;t[3]!==a||t[4]!==n?(c=(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(x,{variant:`ghost`,size:`icon`,className:`mt-1.5 mr-1.5 h-6 w-6 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,"aria-label":a,"data-testid":n,children:o})}),t[3]=a,t[4]=n,t[5]=c):c=t[5];let l;t[6]===r?l=t[7]:(l=(0,$.jsx)(C,{side:`left`,className:`max-w-sm text-left`,children:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:r})}),t[6]=r,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,$.jsxs)(w,{children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function ar(){let e=(0,Z.c)(38),{_:t}=s(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{if(!n)return;let e=!1;return n.integrations.status().then(t=>{e||i(t)}).catch(()=>{e||c(!0)}),()=>{e=!0}},f=[n],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=async function(e,r){if(n){u(rr(e));try{let t=await n.integrations.setComponent({component:e,enabled:r});i(t.status),t.ok||X.error(t.error)}catch(e){let n=e;X.error(t({id:`gfdqcY`,values:{0:n instanceof Error?n.message:String(n)}}))}u(null)}},e[2]=t,e[3]=p);let m=p,h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`h3`,{id:`settings-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(o,{id:`_5qBNl`})}),e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(o,{id:`mLAjyL`})})]}),e[5]=g):g=e[5];let _=g;if(!n||a){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[_,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(o,{id:`O4PnDd`})})]}),e[6]=t):t=e[6],t}if(r===null){let t;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[_,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(pn,{className:`h-10 w-full`}),(0,$.jsx)(pn,{className:`h-10 w-full`}),(0,$.jsx)(pn,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}let v=l!==null||!r.available,y=r.path.shellDetected||r.path.installed,b;e[8]===r.available?b=e[9]:(b=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`ai-tools-read-only`,children:(0,$.jsx)(o,{id:`OplnBG`})}),e[8]=r.available,e[9]=b);let x;e[10]!==t||e[11]!==m||e[12]!==v||e[13]!==y||e[14]!==r.path.installed||e[15]!==r.path.rcFilesToTouch?(x=y&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(o,{id:`ALhMYW`})}),(0,$.jsxs)(`div`,{className:`flex items-start overflow-hidden rounded-md border border-border bg-card/50 hover:bg-accent`,children:[(0,$.jsxs)(V,{htmlFor:`ai-tools-path`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(I,{id:`ai-tools-path`,checked:r.path.installed,disabled:v,onCheckedChange:()=>void m({kind:`path`},!r.path.installed),className:`mt-0.5`,"data-testid":`ai-tools-path-checkbox`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(o,{id:`Fsx78O`,components:{0:(0,$.jsx)(`code`,{className:`inline-code`})}})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-path-status`,children:r.path.installed?t({id:`yhdqox`}):t({id:`04XyCH`,values:{0:r.path.rcFilesToTouch.join(`, `)}})})]})]}),(0,$.jsxs)(ir,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(o,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map(sr),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(o,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[10]=t,e[11]=m,e[12]=v,e[13]=y,e[14]=r.path.installed,e[15]=r.path.rcFilesToTouch,e[16]=x):x=e[16];let S;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(o,{id:`psfGPX`})}),e[17]=S):S=e[17];let C;if(e[18]!==t||e[19]!==m||e[20]!==v||e[21]!==r.editors){let n;e[23]!==t||e[24]!==m||e[25]!==v?(n=e=>{let n=e.state===`installed`||e.state===`foreign`,r=v||e.state===`unmanageable`,i=e.state===`not-installed`&&!e.detected,a=`https://openknowledge.ai/docs/integrations/${Me[e.id]}`,s=e.state===`installed`?t({id:`eQkgKV`}):e.state===`foreign`?t({id:`AczYxH`}):e.state===`unmanageable`?t({id:`LbmLyU`}):e.detected?t({id:`bBE5tC`}):null,c=e.state===`foreign`||e.state===`unmanageable`?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,$.jsxs)(`li`,{className:r?`flex items-start`:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(V,{htmlFor:`ai-tools-editor-${e.id}`,className:r?`flex flex-1 items-start gap-2.5 px-3 py-2.5 font-normal`:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(I,{id:`ai-tools-editor-${e.id}`,checked:n,disabled:r,onCheckedChange:()=>void m({kind:`editor`,id:e.id},!n),className:`mt-0.5`,"data-testid":`ai-tools-editor-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.label}),s!==null&&(0,$.jsx)(`span`,{className:c,"data-testid":`ai-tools-editor-status-${e.id}`,children:s})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>un(e,a),onAuxClick:e=>un(e,a),"aria-label":t({id:`D-Oh1s`,values:{0:e.label}}),className:`flex shrink-0 items-center gap-0.5 px-2 py-2.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`ai-tools-editor-status-${e.id}`,children:[(0,$.jsx)(o,{id:`P_bX4O`}),(0,$.jsx)(et,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(ir,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(o,{id:`J2eKUI`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.configPath??t({id:`ndwmea`})})}),(0,$.jsx)(`p`,{className:`pt-1 opacity-70`,children:(0,$.jsx)(o,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[23]=t,e[24]=m,e[25]=v,e[26]=n):n=e[26],C=r.editors.map(n),e[18]=t,e[19]=m,e[20]=v,e[21]=r.editors,e[22]=C}else C=e[22];let w;e[27]===C?w=e[28]:(w=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[S,(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:C})]}),e[27]=C,e[28]=w);let T;e[29]!==m||e[30]!==v||e[31]!==r.skills?(T=r.skills.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(o,{id:`28B21t`})}),(0,$.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`,children:r.skills.map(e=>(0,$.jsxs)(`li`,{className:`flex items-start hover:bg-accent`,children:[(0,$.jsxs)(V,{htmlFor:`ai-tools-skill-${e.id}`,className:`flex flex-1 cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal`,children:[(0,$.jsx)(I,{id:`ai-tools-skill-${e.id}`,checked:e.installed,disabled:v,onCheckedChange:()=>void m({kind:`skill`,id:e.id},!e.installed),className:`mt-0.5`,"data-testid":`ai-tools-skill-checkbox-${e.id}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:(0,$.jsx)(`code`,{children:e.name})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-skill-status-${e.id}`,children:e.id===`discovery`?(0,$.jsx)(o,{id:`0inVGS`}):(0,$.jsx)(o,{id:`FXk_zY`})})]})]}),(0,$.jsxs)(ir,{testId:`ai-tools-skill-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(o,{id:`HSh8u_`})}),e.paths.map(or)]})]},e.id))})]}),e[29]=m,e[30]=v,e[31]=r.skills,e[32]=T):T=e[32];let E;return e[33]!==T||e[34]!==b||e[35]!==x||e[36]!==w?(E=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[_,b,x,w,T]}),e[33]=T,e[34]=b,e[35]=x,e[36]=w,e[37]=E):E=e[37],E}function or(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function sr(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function cr(e){return{chrome:e.sidebar,surface:e.background,bar:e.primary,line:e.border,dots:[e[`syntax-string`],e[`syntax-keyword`],e[`syntax-atom`]]}}function lr(e,t,n){return e.id===`custom`?cr(Fe(on(t))):e.scheme?cr(Fe(e.scheme)):cr(ln(n))}function ur(e){let t=(0,Z.c)(36),{theme:n,customSeed:r,defaultMode:i}=e,a,o,s,c,l,u,d,f,p;t[0]!==r||t[1]!==i||t[2]!==n?(a=lr(n,r,i),u=!0,d=`aspect-[4/3] w-full overflow-hidden rounded-md border`,f={backgroundColor:a.surface,borderColor:a.line},p=(0,$.jsxs)(`div`,{className:`flex h-1/3 items-center gap-1 px-1.5`,style:{backgroundColor:a.chrome,borderBottom:`1px solid ${a.line}`},children:[(0,$.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{backgroundColor:a.bar}}),(0,$.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full opacity-50`,style:{backgroundColor:a.line}})]}),l=`flex h-2/3`,o=`flex w-1/4 flex-col items-center justify-center gap-1`,s={backgroundColor:a.chrome,borderRight:`1px solid ${a.line}`},c=a.dots.map(dr),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p):(a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11]);let m;t[12]!==o||t[13]!==s||t[14]!==c?(m=(0,$.jsx)(`div`,{className:o,style:s,children:c}),t[12]=o,t[13]=s,t[14]=c,t[15]=m):m=t[15];let h;t[16]===a.dots[1]?h=t[17]:(h=(0,$.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-full`,style:{backgroundColor:a.dots[1]}}),t[16]=a.dots[1],t[17]=h);let g;t[18]===a.line?g=t[19]:(g=(0,$.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-full opacity-60`,style:{backgroundColor:a.line}}),t[18]=a.line,t[19]=g);let _;t[20]===a.dots[0]?_=t[21]:(_=(0,$.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-full`,style:{backgroundColor:a.dots[0]}}),t[20]=a.dots[0],t[21]=_);let v;t[22]!==h||t[23]!==g||t[24]!==_?(v=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1 px-1.5`,children:[h,g,_]}),t[22]=h,t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==v||t[27]!==l||t[28]!==m?(y=(0,$.jsxs)(`div`,{className:l,children:[m,v]}),t[26]=v,t[27]=l,t[28]=m,t[29]=y):y=t[29];let b;return t[30]!==y||t[31]!==u||t[32]!==d||t[33]!==f||t[34]!==p?(b=(0,$.jsxs)(`div`,{"aria-hidden":u,className:d,style:f,children:[p,y]}),t[30]=y,t[31]=u,t[32]=d,t[33]=f,t[34]=p,t[35]=b):b=t[35],b}function dr(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function fr(e){let t=(0,Z.c)(11),{value:n,onSelect:r,customSeed:i,defaultMode:a,id:o,"aria-label":c,"aria-describedby":l}=e,u=a===void 0?`light`:a,{_:d}=s(),f=Pe.some(e=>e.id===n)?n:`default`,p;t[0]!==d||t[1]!==i||t[2]!==u?(p=Pe.map(e=>(0,$.jsxs)(ie,{value:e.id,className:h(`group/tile flex flex-col gap-1.5 rounded-lg border-2 border-transparent p-1 text-left outline-none`,`hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40`,`data-checked:border-primary`),children:[(0,$.jsx)(ur,{theme:e,customSeed:i,defaultMode:u}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-0.5`,children:[(0,$.jsx)(`span`,{className:`text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.id===`custom`?en(on(i))===`dark`?d({id:`pvnfJD`}):d({id:`1njn7W`}):e.kind===`system`?d({id:`R9Khdg`}):e.kind===`light`?d({id:`1njn7W`}):d({id:`pvnfJD`})})]})]},e.id)),t[0]=d,t[1]=i,t[2]=u,t[3]=p):p=t[3];let m;return t[4]!==l||t[5]!==c||t[6]!==o||t[7]!==r||t[8]!==f||t[9]!==p?(m=(0,$.jsx)(re,{id:o,"aria-label":c,"aria-describedby":l,value:f,onValueChange:r,className:`grid w-full grid-cols-2 gap-2 sm:grid-cols-3`,children:p}),t[4]=l,t[5]=c,t[6]=o,t[7]=r,t[8]=f,t[9]=p,t[10]=m):m=t[10],m}function pr(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:pr(r,t)}}function mr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function hr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function gr(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}function _r(e){if(!ke(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function vr(){let e=(0,Z.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(pn,{className:`h-5 w-32`}),n=(0,$.jsx)(pn,{className:`h-4 w-64`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[t,n,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(pn,{className:`h-9 w-full`}),(0,$.jsx)(pn,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function yr({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=s(),a=In(),c=Te(xe,e.path),l=c?hr(c):void 0,u=c?mr(c):void 0,d=c?gr(c):void 0,f=c?Ne(c):void 0,p=f?.scope===`project`&&t!==`project`||f?.scope===`user`&&t!==`user`,m=e.path.join(`.`),g=i(e.label),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{y.current&&clearTimeout(y.current)},[]);let b=()=>{v(!0),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>v(!1),1200)},T=()=>{let e=n(m);return e&&b(),e},E=()=>a.getFieldState(m).isDirty?T():!0,D=()=>{let e=u===void 0?null:u;a.setValue(m,e,{shouldDirty:!1}),T()},O=h(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(Nn,{control:a.control,name:m,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(jn,{className:O,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(Fn,{className:`text-sm font-medium`,children:g}),r?(0,$.jsxs)(w,{children:[(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:D,"aria-label":i({id:`lhjq3G`,values:{labelText:g}}),children:(0,$.jsx)(Pt,{className:`size-3.5`})})}),(0,$.jsx)(C,{children:(0,$.jsx)(o,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(Ln,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Pn,{children:(0,$.jsx)(br,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:E})}),(0,$.jsx)(wr,{visible:_,srOnly:e.control===`theme-tiles`})]}),(0,$.jsx)(Rn,{"data-field-error":e.path.join(`.`)})]})}})}function br({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";let{_:o}=s(),{setTheme:c,systemTheme:u}=l(),d=sn()?.merged??null;if(e.control===`theme-tiles`){let{id:n,...r}=a,s=d?.appearance?.customTheme,l=d?.appearance?.theme,f=l===`light`||l===`dark`?l:u===`dark`?`dark`:`light`;return(0,$.jsx)(fr,{...r,id:n,value:typeof t.value==`string`?t.value:`default`,customSeed:s,defaultMode:f,"aria-label":o(e.label),onSelect:e=>{if($t(e,s),e===`custom`)c(en(on(s))===`dark`?`dark`:`light`);else{let t=Re(e);t&&c(t)}t.onChange(e),i()}})}if(n===`boolean`)return(0,$.jsx)(K,{...a,checked:!!t.value,ref:t.ref,onCheckedChange:e=>{t.onChange(e),i()},onBlur:t.onBlur});if(n===`enum`&&r&&r.length>0&&(e.control===`enum-toggle`||r.length<=4)){let{id:n,...s}=a,l=e.path[0]===`appearance`&&e.path[1]===`theme`;return(0,$.jsx)(ae,{...s,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{e&&(l&&c(e),t.onChange(e),i())},onBlur:t.onBlur,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":o(e.label),children:r.map((e,t)=>(0,$.jsx)(q,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Sr,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(Cr,{ctl:t,onCommit:i,...a}):(0,$.jsx)(xr,{ctl:t,onCommit:i,...a})}function xr({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Vt,{...n,value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),t()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t())},className:`h-8 text-sm`})}function Sr({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Q.useState)(e.value===void 0?``:String(e.value)),a=(0,Q.useRef)(e.value);(0,Q.useEffect)(()=>{a.current!==e.value&&(i(e.value===void 0?``:String(e.value)),a.current=e.value)},[e.value]);let o=()=>{let n=Number(r);if(!Number.isFinite(n)){e.onChange(r),t();return}e.onChange(n),t(),a.current=n};return(0,$.jsx)(Vt,{...n,type:`number`,value:r,ref:e.ref,onChange:e=>i(e.target.value),onBlur:()=>{e.onBlur(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},className:`h-8 w-28 text-sm tabular-nums`})}function Cr({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
2
2
  `):``,[i,a]=(0,Q.useState)(r),o=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{let t=Array.isArray(e.value)?e.value.join(`
3
3
  `):``;t!==o.current&&(a(t),o.current=t)},[e.value]);let s=()=>{let n=i.split(`
4
4
  `).map(e=>e.trim()).filter(e=>e.length>0);e.onChange(n),t(),o.current=n.join(`
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-RQ5o7P7w.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-FGMqkFjm.js";import{n as se,t as s}from"./git-branch-le6ClqcQ.js";import{t as c}from"./loader-circle-DJ1nzSAL.js";import{n as ce,t as le}from"./miss-dialog-store-BGDBpPYJ.js";import{n as l}from"./dist-uN7pEWl0.js";import{t as u}from"./desktop-bridge-types-FXg4M54A.js";import{r as d,t as f}from"./auth-prompt-store-CeUwLE3s.js";import{a as p,n as m}from"./receive-store-CTNYU3q-.js";import{t as ue}from"./share-metadata-rows-CuFlpaJB.js";var h=e(n(),1),de=a();function fe(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 pe(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function g(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 me={phase:`loading`};function he(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function ge(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function _e(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ve(e){return fe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ye(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function be(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 xe(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=g(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 Se(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0}}:{state:e}}var _=t();function Ce(e){return e!==null&&e.kind===`project-branch-switch`}function v(e){let t=(0,de.c)(217),{bridge:n,store:a}=e,f=a===void 0?m:a,{_:g}=i(),v=(0,h.useSyncExternalStore)(f.subscribe,f.getSnapshot,je),[y,b]=(0,h.useState)(me),Me=(0,h.useRef)(!1),Ne=(0,h.useRef)(!1),Pe=(0,h.useRef)(!1),Fe=(0,h.useRef)(null),Ie;t[0]===v?Ie=t[1]:(Ie=Ce(v)?v:null,t[0]=v,t[1]=Ie);let x=Ie,Le;t[2]!==g||t[3]!==x?.share.target.kind?(Le=x?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=x?.share.target.kind,t[4]=Le):Le=t[4];let S=Le,Re;t[5]===x?Re=t[6]:(Re=()=>{b(me),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=x},t[5]=x,t[6]=Re);let ze;t[7]===v?ze=t[8]:(ze=[v],t[7]=v,t[8]=ze),(0,h.useEffect)(Re,ze);let Be;t[9]!==x||t[10]!==n?(Be=()=>{if(!x||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:u(x.share.target)}).then(t=>{e||b(e=>he(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),b(Ae))}),()=>{e=!0}},t[9]=x,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===x?Ve=t[13]:(Ve=[x],t[12]=x,t[13]=Ve),(0,h.useEffect)(Be,Ve);let He;t[14]!==x||t[15]!==y.info||t[16]!==y.phase||t[17]!==n?(He=()=>{if(!x||y.phase!==`ready`||Pe.current||!ve(y.info))return;Pe.current=!0,b(ye);let e=x;n.project.fetchTargetStatus({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:u(x.share.target)}).then(t=>{Fe.current===e&&b(e=>be(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),b(ke))})},t[14]=x,t[15]=y.info,t[16]=y.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==x||t[20]!==y.phase?(Ue=[y.phase,x],t[19]=x,t[20]=y.phase,t[21]=Ue):Ue=t[21],(0,h.useEffect)(He,Ue);let We;t[22]!==x||t[23]!==y.phase||t[24]!==y.resolution||t[25]!==f?(We=()=>{if(y.phase!==`verdict`)return;let{kind:e}=y.resolution;e!==`deleted`&&e!==`never-on-branch`||x&&(le.arm({kind:x.share.target.kind,path:u(x.share.target),branch:x.share.branch}),f.dismiss())},t[22]=x,t[23]=y.phase,t[24]=y.resolution,t[25]=f,t[26]=We):We=t[26];let Ge;t[27]!==x||t[28]!==y||t[29]!==f?(Ge=[y,x,f],t[27]=x,t[28]=y,t[29]=f,t[30]=Ge):Ge=t[30],(0,h.useEffect)(We,Ge);let Ke;t[31]!==y.phase||t[32]!==y.resolution?(Ke=()=>{y.phase===`verdict`&&console.log(p({verdict_cell:y.resolution.kind}))},t[31]=y.phase,t[32]=y.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===y?qe=t[35]:(qe=[y],t[34]=y,t[35]=qe),(0,h.useEffect)(Ke,qe);let Je;t[36]!==g||t[37]!==x||t[38]!==y.pendingDoc||t[39]!==y.phase||t[40]!==n||t[41]!==f||t[42]!==S?(Je=()=>{if(y.phase!==`awaiting-cc1-recycle`||!x)return;let e=x.share.branch,t=y.pendingDoc;if(!e){f.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:x.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(p({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:x.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.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:S}}))}),f.dismiss();return}console.log(p({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(g({id:`LBwUR6`,values:{targetNoun:S}})),f.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(g({id:`Jw6EC4`,values:{targetNoun:S}})),f.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=x,t[38]=y.pendingDoc,t[39]=y.phase,t[40]=n,t[41]=f,t[42]=S,t[43]=Je):Je=t[43];let Ye;if(t[44]!==x||t[45]!==y.phase?(Ye=[y.phase,x],t[44]=x,t[45]=y.phase,t[46]=Ye):Ye=t[46],(0,h.useEffect)(Je,Ye),!x)return null;let{share:C,projectPath:w,currentBranch:Xe}=x,T=C.branch,Ze;t[47]!==g||t[48]!==n.project||t[49]!==w||t[50]!==T||t[51]!==f?(Ze=function(e,t,r){console.log(p({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),b(t=>ge(t,e)),n.project.runCheckout(t?{projectPath:w,branch:T,fastForward:!0}:{projectPath:w,branch:T}).then(e=>{let t=null,n=!1;b(r=>{let{state:i,sideEffect:a}=xe(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&&f.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),b(Oe),l.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=w,t[50]=T,t[51]=f,t[52]=Ze):Ze=t[52];let E=Ze,Qe;t[53]!==y.info||t[54]!==y.phase||t[55]!==E||t[56]!==C.target?(Qe=function(){y.phase===`ready`&&fe(y.info).switchEnabled&&E(u(C.target),!1)},t[53]=y.info,t[54]=y.phase,t[55]=E,t[56]=C.target,t[57]=Qe):Qe=t[57];let $e=Qe,et;t[58]!==y.phase||t[59]!==y.resolution||t[60]!==E||t[61]!==C.target?(et=function(){y.phase===`verdict`&&E(u(C.target),!0,y.resolution.kind)},t[58]=y.phase,t[59]=y.resolution,t[60]=E,t[61]=C.target,t[62]=et):et=t[62];let tt=et,nt;t[63]!==y.phase||t[64]!==y.resolution||t[65]!==E?(nt=function(){y.phase===`verdict`&&y.resolution.kind===`renamed`&&E(y.resolution.renamedTo,!0,y.resolution.kind)},t[63]=y.phase,t[64]=y.resolution,t[65]=E,t[66]=nt):nt=t[66];let rt=nt,it;t[67]!==y.phase||t[68]!==y.resolution||t[69]!==E||t[70]!==C.target?(it=function(){y.phase===`verdict`&&E(u(C.target),!1,y.resolution.kind)},t[67]=y.phase,t[68]=y.resolution,t[69]=E,t[70]=C.target,t[71]=it):it=t[71];let at=it,ot;t[72]!==g||t[73]!==n.project||t[74]!==w||t[75]!==C.target||t[76]!==T||t[77]!==f||t[78]!==S?(ot=function(){console.log(p({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:w,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:u(C.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:S}}))}),f.dismiss()},t[72]=g,t[73]=n.project,t[74]=w,t[75]=C.target,t[76]=T,t[77]=f,t[78]=S,t[79]=ot):ot=t[79];let st=ot,ct;t[80]!==g||t[81]!==T?(ct=function(e,t,n){if(e===`fetch-failed`&&n){l.error(g({id:`gfb-CM`}),{action:{label:g({id:`5lWFkC`}),onClick:De}});return}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]=ct):ct=t[82];let lt=ct,ut;t[83]!==g||t[84]!==n.project||t[85]!==C.target||t[86]!==T||t[87]!==lt||t[88]!==f?(ut=function(e){let t=null,r,i,a=!1,o=null;if(b(n=>{let{state:ee,sideEffect:te}=Se(n,e);return te&&(t=te.reason,r=te.helper,i=te.authFailed,a=ee.phase===`dismissed`),ee.phase===`opening-worktree`&&(o=ee.path),ee}),t!==null&&(console.log(p({branch_dialog_action:`open-worktree-failed:${t}`,branch:T})),lt(t,r,i)),o!==null){d();let e=o;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:C.target.kind,path:u(C.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}}))}),f.dismiss()}a&&f.dismiss()},t[83]=g,t[84]=n.project,t[85]=C.target,t[86]=T,t[87]=lt,t[88]=f,t[89]=ut):ut=t[89];let dt=ut,ft;t[90]!==dt||t[91]!==y.phase||t[92]!==n.worktree||t[93]!==T?(ft=function(){y.phase===`ready`&&(console.log(p({branch_dialog_action:`open-worktree`,branch:T})),b(_e),n.worktree.checkout({branch:T}).then(e=>{dt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),dt(null)}))},t[90]=dt,t[91]=y.phase,t[92]=n.worktree,t[93]=T,t[94]=ft):ft=t[94];let pt=ft,mt;t[95]!==g||t[96]!==y.otherWorktreePath||t[97]!==y.phase||t[98]!==n.project||t[99]!==C.target||t[100]!==T||t[101]!==f?(mt=function(){if(y.phase!==`branch-in-other-worktree`)return;let e=y.otherWorktreePath;console.log(p({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:u(C.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}}))}),f.dismiss()},t[95]=g,t[96]=y.otherWorktreePath,t[97]=y.phase,t[98]=n.project,t[99]=C.target,t[100]=T,t[101]=f,t[102]=mt):mt=t[102];let ht=mt,gt;t[103]!==y.phase||t[104]!==y.resolution||t[105]!==f?(gt=function(){console.log(p({branch_dialog_action:`cancel`,verdict_cell:y.phase===`verdict`?y.resolution.kind:void 0})),f.dismiss()},t[103]=y.phase,t[104]=y.resolution,t[105]=f,t[106]=gt):gt=t[106];let D=gt,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]!==y.info||t[109]!==y.otherWorktreePath||t[110]!==y.phase||t[111]!==y.resolution||t[112]!==D||t[113]!==Xe||t[114]!==C.branch||t[115]!==C.owner||t[116]!==C.repo||t[117]!==C.target||t[118]!==T||t[119]!==S){G=y.phase===`ready`||y.phase===`switching`||y.phase===`creating-worktree`?fe(y.info):null;let e;t[139]!==y.info||t[140]!==y.phase||t[141]!==Xe?(e=y.phase===`ready`||y.phase===`switching`||y.phase===`creating-worktree`?pe(y.info):Xe??`HEAD`,t[139]=y.info,t[140]=y.phase,t[141]=Xe,t[142]=e):e=t[142];let n=e;P=y.phase===`switching`||y.phase===`awaiting-cc1-recycle`,j=y.phase===`creating-worktree`;let i;t[143]===g?i=t[144]:(i=g({id:`OuY8t9`}),t[143]=g,t[144]=i),M=i;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=y.phase===`loading`,se=y.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=Ee,V=Te;let s;t[151]===S?s=t[152]:(s=(0,_.jsx)(te,{children:(0,_.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:S}})}),t[151]=S,t[152]=s);let ce=C.owner,le=C.repo,l;t[153]===C.target?l=t[154]:(l=u(C.target),t[153]=C.target,t[154]=l);let d;t[155]!==C.owner||t[156]!==C.repo||t[157]!==l?(d=(0,_.jsx)(ee,{className:`sr-only`,children:(0,_.jsx)(r,{id:`f8jU-L`,values:{0:ce,1:le,2:l}})}),t[155]=C.owner,t[156]=C.repo,t[157]=l,t[158]=d):d=t[158],t[159]!==s||t[160]!==d?(H=(0,_.jsxs)(ae,{children:[s,d]}),t[159]=s,t[160]=d,t[161]=H):H=t[161],O=re;let f=C.owner,p=C.repo,m;t[162]===C.target?m=t[163]:(m=u(C.target),t[162]=C.target,t[163]=m),t[164]!==C.branch||t[165]!==C.owner||t[166]!==C.repo||t[167]!==C.target.kind||t[168]!==m?(F=(0,_.jsx)(`div`,{className:`mb-4`,children:(0,_.jsx)(ue,{owner:f,repo:p,path:m,kind:C.target.kind,branch:C.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=C.branch,t[165]=C.owner,t[166]=C.repo,t[167]=C.target.kind,t[168]=m,t[169]=F):F=t[169],I=y.phase===`branch-in-other-worktree`?(0,_.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,_.jsx)(`p`,{className:`leading-6`,children:(0,_.jsx)(r,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,_.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:y.otherWorktreePath})]}):y.phase===`verdict-pending`?(0,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`c8jBgX`})]}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,_.jsx)(r,{id:`Uay5NL`,values:{targetNoun:S,shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`renamed`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,_.jsx)(r,{id:`P0HC30`,values:{0:y.resolution.renamedTo,targetNoun:S},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`diverged`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,_.jsx)(r,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:S},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`c8jBgX`})]}):ie?(0,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`jerqF0`})]}):se?(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,_.jsx)(r,{id:`w4hMYl`})}):G?.kind===`D`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`DTI-fp`,values:{targetNoun:S,shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:S,shareBranch:T,currentLabel:n},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`_902BE`,values:{targetNoun:S,shareBranch:T,currentLabel:n},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,_.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,_.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,_.jsx)(r,{id:`n2lRue`})}),(0,_.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(we)})]}):null,t[107]=g,t[108]=y.info,t[109]=y.otherWorktreePath,t[110]=y.phase,t[111]=y.resolution,t[112]=D,t[113]=Xe,t[114]=C.branch,t[115]=C.owner,t[116]=C.repo,t[117]=C.target,t[118]=T,t[119]=S,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,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{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,_.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 _t;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,_.jsx)(r,{id:`dEgA5A`}),t[181]=_t):_t=t[181];let X;t[182]===D?X=t[183]:(X=(0,_.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:_t}),t[182]=D,t[183]=X);let Z;t[184]!==y.phase||t[185]!==y.resolution||t[186]!==j||t[187]!==st||t[188]!==rt||t[189]!==pt||t[190]!==ht||t[191]!==at||t[192]!==$e||t[193]!==tt||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=y.phase===`branch-in-other-worktree`?(0,_.jsx)(o,{onClick:ht,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,_.jsx)(r,{id:`hyCxJY`})}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,_.jsxs)(o,{onClick:tt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,_.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`uA_jXp`})]}):y.resolution.kind===`renamed`?(0,_.jsxs)(o,{onClick:rt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,_.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`AItsE5`})]}):y.resolution.kind===`diverged`?(0,_.jsxs)(o,{onClick:at,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,_.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,_.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,_.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:st,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,_.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,_.jsx)(o,{variant:`outline`,onClick:$e,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,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),N]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,_.jsx)(o,{onClick:pt,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),K]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=y.phase,t[185]=y.resolution,t[186]=j,t[187]=st,t[188]=rt,t[189]=pt,t[190]=ht,t[191]=at,t[192]=$e,t[193]=tt,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,_.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,_.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 vt;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(vt=(0,_.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=vt):vt=t[216],vt}function we(e){return(0,_.jsx)(`li`,{children:(0,_.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Te(e){e.preventDefault()}function Ee(e){e.preventDefault()}function De(){return f.request()}function Oe(e){return xe(e,null).state}function ke(e){return be(e,null)}function Ae(e){return he(e,null)}function je(){return null}export{v as ShareBranchSwitchDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-RQ5o7P7w.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-FGMqkFjm.js";import{n as se,t as s}from"./git-branch-le6ClqcQ.js";import{t as c}from"./loader-circle-DJ1nzSAL.js";import{n as ce,t as le}from"./miss-dialog-store-BGDBpPYJ.js";import{n as l}from"./dist-uN7pEWl0.js";import{t as u}from"./desktop-bridge-types-FXg4M54A.js";import{r as d,t as f}from"./auth-prompt-store-CeUwLE3s.js";import{a as p,n as m}from"./receive-store-BlAqmJZT.js";import{t as ue}from"./share-metadata-rows-CuFlpaJB.js";var h=e(n(),1),de=a();function fe(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 pe(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function g(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 me={phase:`loading`};function he(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function ge(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function _e(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ve(e){return fe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ye(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function be(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 xe(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=g(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 Se(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0}}:{state:e}}var _=t();function Ce(e){return e!==null&&e.kind===`project-branch-switch`}function v(e){let t=(0,de.c)(217),{bridge:n,store:a}=e,f=a===void 0?m:a,{_:g}=i(),v=(0,h.useSyncExternalStore)(f.subscribe,f.getSnapshot,je),[y,b]=(0,h.useState)(me),Me=(0,h.useRef)(!1),Ne=(0,h.useRef)(!1),Pe=(0,h.useRef)(!1),Fe=(0,h.useRef)(null),Ie;t[0]===v?Ie=t[1]:(Ie=Ce(v)?v:null,t[0]=v,t[1]=Ie);let x=Ie,Le;t[2]!==g||t[3]!==x?.share.target.kind?(Le=x?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=x?.share.target.kind,t[4]=Le):Le=t[4];let S=Le,Re;t[5]===x?Re=t[6]:(Re=()=>{b(me),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=x},t[5]=x,t[6]=Re);let ze;t[7]===v?ze=t[8]:(ze=[v],t[7]=v,t[8]=ze),(0,h.useEffect)(Re,ze);let Be;t[9]!==x||t[10]!==n?(Be=()=>{if(!x||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:u(x.share.target)}).then(t=>{e||b(e=>he(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),b(Ae))}),()=>{e=!0}},t[9]=x,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===x?Ve=t[13]:(Ve=[x],t[12]=x,t[13]=Ve),(0,h.useEffect)(Be,Ve);let He;t[14]!==x||t[15]!==y.info||t[16]!==y.phase||t[17]!==n?(He=()=>{if(!x||y.phase!==`ready`||Pe.current||!ve(y.info))return;Pe.current=!0,b(ye);let e=x;n.project.fetchTargetStatus({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:u(x.share.target)}).then(t=>{Fe.current===e&&b(e=>be(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),b(ke))})},t[14]=x,t[15]=y.info,t[16]=y.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==x||t[20]!==y.phase?(Ue=[y.phase,x],t[19]=x,t[20]=y.phase,t[21]=Ue):Ue=t[21],(0,h.useEffect)(He,Ue);let We;t[22]!==x||t[23]!==y.phase||t[24]!==y.resolution||t[25]!==f?(We=()=>{if(y.phase!==`verdict`)return;let{kind:e}=y.resolution;e!==`deleted`&&e!==`never-on-branch`||x&&(le.arm({kind:x.share.target.kind,path:u(x.share.target),branch:x.share.branch}),f.dismiss())},t[22]=x,t[23]=y.phase,t[24]=y.resolution,t[25]=f,t[26]=We):We=t[26];let Ge;t[27]!==x||t[28]!==y||t[29]!==f?(Ge=[y,x,f],t[27]=x,t[28]=y,t[29]=f,t[30]=Ge):Ge=t[30],(0,h.useEffect)(We,Ge);let Ke;t[31]!==y.phase||t[32]!==y.resolution?(Ke=()=>{y.phase===`verdict`&&console.log(p({verdict_cell:y.resolution.kind}))},t[31]=y.phase,t[32]=y.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===y?qe=t[35]:(qe=[y],t[34]=y,t[35]=qe),(0,h.useEffect)(Ke,qe);let Je;t[36]!==g||t[37]!==x||t[38]!==y.pendingDoc||t[39]!==y.phase||t[40]!==n||t[41]!==f||t[42]!==S?(Je=()=>{if(y.phase!==`awaiting-cc1-recycle`||!x)return;let e=x.share.branch,t=y.pendingDoc;if(!e){f.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:x.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(p({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:x.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.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:S}}))}),f.dismiss();return}console.log(p({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(g({id:`LBwUR6`,values:{targetNoun:S}})),f.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(g({id:`Jw6EC4`,values:{targetNoun:S}})),f.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=x,t[38]=y.pendingDoc,t[39]=y.phase,t[40]=n,t[41]=f,t[42]=S,t[43]=Je):Je=t[43];let Ye;if(t[44]!==x||t[45]!==y.phase?(Ye=[y.phase,x],t[44]=x,t[45]=y.phase,t[46]=Ye):Ye=t[46],(0,h.useEffect)(Je,Ye),!x)return null;let{share:C,projectPath:w,currentBranch:Xe}=x,T=C.branch,Ze;t[47]!==g||t[48]!==n.project||t[49]!==w||t[50]!==T||t[51]!==f?(Ze=function(e,t,r){console.log(p({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),b(t=>ge(t,e)),n.project.runCheckout(t?{projectPath:w,branch:T,fastForward:!0}:{projectPath:w,branch:T}).then(e=>{let t=null,n=!1;b(r=>{let{state:i,sideEffect:a}=xe(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&&f.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),b(Oe),l.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=w,t[50]=T,t[51]=f,t[52]=Ze):Ze=t[52];let E=Ze,Qe;t[53]!==y.info||t[54]!==y.phase||t[55]!==E||t[56]!==C.target?(Qe=function(){y.phase===`ready`&&fe(y.info).switchEnabled&&E(u(C.target),!1)},t[53]=y.info,t[54]=y.phase,t[55]=E,t[56]=C.target,t[57]=Qe):Qe=t[57];let $e=Qe,et;t[58]!==y.phase||t[59]!==y.resolution||t[60]!==E||t[61]!==C.target?(et=function(){y.phase===`verdict`&&E(u(C.target),!0,y.resolution.kind)},t[58]=y.phase,t[59]=y.resolution,t[60]=E,t[61]=C.target,t[62]=et):et=t[62];let tt=et,nt;t[63]!==y.phase||t[64]!==y.resolution||t[65]!==E?(nt=function(){y.phase===`verdict`&&y.resolution.kind===`renamed`&&E(y.resolution.renamedTo,!0,y.resolution.kind)},t[63]=y.phase,t[64]=y.resolution,t[65]=E,t[66]=nt):nt=t[66];let rt=nt,it;t[67]!==y.phase||t[68]!==y.resolution||t[69]!==E||t[70]!==C.target?(it=function(){y.phase===`verdict`&&E(u(C.target),!1,y.resolution.kind)},t[67]=y.phase,t[68]=y.resolution,t[69]=E,t[70]=C.target,t[71]=it):it=t[71];let at=it,ot;t[72]!==g||t[73]!==n.project||t[74]!==w||t[75]!==C.target||t[76]!==T||t[77]!==f||t[78]!==S?(ot=function(){console.log(p({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:w,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:u(C.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:S}}))}),f.dismiss()},t[72]=g,t[73]=n.project,t[74]=w,t[75]=C.target,t[76]=T,t[77]=f,t[78]=S,t[79]=ot):ot=t[79];let st=ot,ct;t[80]!==g||t[81]!==T?(ct=function(e,t,n){if(e===`fetch-failed`&&n){l.error(g({id:`gfb-CM`}),{action:{label:g({id:`5lWFkC`}),onClick:De}});return}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]=ct):ct=t[82];let lt=ct,ut;t[83]!==g||t[84]!==n.project||t[85]!==C.target||t[86]!==T||t[87]!==lt||t[88]!==f?(ut=function(e){let t=null,r,i,a=!1,o=null;if(b(n=>{let{state:ee,sideEffect:te}=Se(n,e);return te&&(t=te.reason,r=te.helper,i=te.authFailed,a=ee.phase===`dismissed`),ee.phase===`opening-worktree`&&(o=ee.path),ee}),t!==null&&(console.log(p({branch_dialog_action:`open-worktree-failed:${t}`,branch:T})),lt(t,r,i)),o!==null){d();let e=o;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:C.target.kind,path:u(C.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}}))}),f.dismiss()}a&&f.dismiss()},t[83]=g,t[84]=n.project,t[85]=C.target,t[86]=T,t[87]=lt,t[88]=f,t[89]=ut):ut=t[89];let dt=ut,ft;t[90]!==dt||t[91]!==y.phase||t[92]!==n.worktree||t[93]!==T?(ft=function(){y.phase===`ready`&&(console.log(p({branch_dialog_action:`open-worktree`,branch:T})),b(_e),n.worktree.checkout({branch:T}).then(e=>{dt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),dt(null)}))},t[90]=dt,t[91]=y.phase,t[92]=n.worktree,t[93]=T,t[94]=ft):ft=t[94];let pt=ft,mt;t[95]!==g||t[96]!==y.otherWorktreePath||t[97]!==y.phase||t[98]!==n.project||t[99]!==C.target||t[100]!==T||t[101]!==f?(mt=function(){if(y.phase!==`branch-in-other-worktree`)return;let e=y.otherWorktreePath;console.log(p({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:u(C.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}}))}),f.dismiss()},t[95]=g,t[96]=y.otherWorktreePath,t[97]=y.phase,t[98]=n.project,t[99]=C.target,t[100]=T,t[101]=f,t[102]=mt):mt=t[102];let ht=mt,gt;t[103]!==y.phase||t[104]!==y.resolution||t[105]!==f?(gt=function(){console.log(p({branch_dialog_action:`cancel`,verdict_cell:y.phase===`verdict`?y.resolution.kind:void 0})),f.dismiss()},t[103]=y.phase,t[104]=y.resolution,t[105]=f,t[106]=gt):gt=t[106];let D=gt,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]!==y.info||t[109]!==y.otherWorktreePath||t[110]!==y.phase||t[111]!==y.resolution||t[112]!==D||t[113]!==Xe||t[114]!==C.branch||t[115]!==C.owner||t[116]!==C.repo||t[117]!==C.target||t[118]!==T||t[119]!==S){G=y.phase===`ready`||y.phase===`switching`||y.phase===`creating-worktree`?fe(y.info):null;let e;t[139]!==y.info||t[140]!==y.phase||t[141]!==Xe?(e=y.phase===`ready`||y.phase===`switching`||y.phase===`creating-worktree`?pe(y.info):Xe??`HEAD`,t[139]=y.info,t[140]=y.phase,t[141]=Xe,t[142]=e):e=t[142];let n=e;P=y.phase===`switching`||y.phase===`awaiting-cc1-recycle`,j=y.phase===`creating-worktree`;let i;t[143]===g?i=t[144]:(i=g({id:`OuY8t9`}),t[143]=g,t[144]=i),M=i;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=y.phase===`loading`,se=y.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=Ee,V=Te;let s;t[151]===S?s=t[152]:(s=(0,_.jsx)(te,{children:(0,_.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:S}})}),t[151]=S,t[152]=s);let ce=C.owner,le=C.repo,l;t[153]===C.target?l=t[154]:(l=u(C.target),t[153]=C.target,t[154]=l);let d;t[155]!==C.owner||t[156]!==C.repo||t[157]!==l?(d=(0,_.jsx)(ee,{className:`sr-only`,children:(0,_.jsx)(r,{id:`f8jU-L`,values:{0:ce,1:le,2:l}})}),t[155]=C.owner,t[156]=C.repo,t[157]=l,t[158]=d):d=t[158],t[159]!==s||t[160]!==d?(H=(0,_.jsxs)(ae,{children:[s,d]}),t[159]=s,t[160]=d,t[161]=H):H=t[161],O=re;let f=C.owner,p=C.repo,m;t[162]===C.target?m=t[163]:(m=u(C.target),t[162]=C.target,t[163]=m),t[164]!==C.branch||t[165]!==C.owner||t[166]!==C.repo||t[167]!==C.target.kind||t[168]!==m?(F=(0,_.jsx)(`div`,{className:`mb-4`,children:(0,_.jsx)(ue,{owner:f,repo:p,path:m,kind:C.target.kind,branch:C.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=C.branch,t[165]=C.owner,t[166]=C.repo,t[167]=C.target.kind,t[168]=m,t[169]=F):F=t[169],I=y.phase===`branch-in-other-worktree`?(0,_.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,_.jsx)(`p`,{className:`leading-6`,children:(0,_.jsx)(r,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,_.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:y.otherWorktreePath})]}):y.phase===`verdict-pending`?(0,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`c8jBgX`})]}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,_.jsx)(r,{id:`Uay5NL`,values:{targetNoun:S,shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`renamed`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,_.jsx)(r,{id:`P0HC30`,values:{0:y.resolution.renamedTo,targetNoun:S},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`diverged`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,_.jsx)(r,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:S},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`c8jBgX`})]}):ie?(0,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`jerqF0`})]}):se?(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,_.jsx)(r,{id:`w4hMYl`})}):G?.kind===`D`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`DTI-fp`,values:{targetNoun:S,shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:S,shareBranch:T,currentLabel:n},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`_902BE`,values:{targetNoun:S,shareBranch:T,currentLabel:n},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,_.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,_.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,_.jsx)(r,{id:`n2lRue`})}),(0,_.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(we)})]}):null,t[107]=g,t[108]=y.info,t[109]=y.otherWorktreePath,t[110]=y.phase,t[111]=y.resolution,t[112]=D,t[113]=Xe,t[114]=C.branch,t[115]=C.owner,t[116]=C.repo,t[117]=C.target,t[118]=T,t[119]=S,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,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,_.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,_.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,_.jsx)(r,{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,_.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 _t;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,_.jsx)(r,{id:`dEgA5A`}),t[181]=_t):_t=t[181];let X;t[182]===D?X=t[183]:(X=(0,_.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:_t}),t[182]=D,t[183]=X);let Z;t[184]!==y.phase||t[185]!==y.resolution||t[186]!==j||t[187]!==st||t[188]!==rt||t[189]!==pt||t[190]!==ht||t[191]!==at||t[192]!==$e||t[193]!==tt||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=y.phase===`branch-in-other-worktree`?(0,_.jsx)(o,{onClick:ht,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,_.jsx)(r,{id:`hyCxJY`})}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,_.jsxs)(o,{onClick:tt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,_.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`uA_jXp`})]}):y.resolution.kind===`renamed`?(0,_.jsxs)(o,{onClick:rt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,_.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`AItsE5`})]}):y.resolution.kind===`diverged`?(0,_.jsxs)(o,{onClick:at,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,_.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,_.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,_.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:st,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,_.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,_.jsx)(o,{variant:`outline`,onClick:$e,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,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),N]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,_.jsx)(o,{onClick:pt,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),K]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=y.phase,t[185]=y.resolution,t[186]=j,t[187]=st,t[188]=rt,t[189]=pt,t[190]=ht,t[191]=at,t[192]=$e,t[193]=tt,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,_.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,_.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 vt;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(vt=(0,_.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=vt):vt=t[216],vt}function we(e){return(0,_.jsx)(`li`,{children:(0,_.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Te(e){e.preventDefault()}function Ee(e){e.preventDefault()}function De(){return f.request()}function Oe(e){return xe(e,null).state}function ke(e){return be(e,null)}function Ae(e){return he(e,null)}function je(){return null}export{v as ShareBranchSwitchDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-RQ5o7P7w.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-FGMqkFjm.js";import{an as u,sn as d}from"./dist-DIn3VYDc2.js";import{t as ie}from"./loader-circle-DJ1nzSAL.js";import{n as f}from"./dist-uN7pEWl0.js";import{t as p}from"./desktop-bridge-types-FXg4M54A.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-CTNYU3q-.js";import{t as se}from"./share-metadata-rows-CuFlpaJB.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function C(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return 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:a,cloneController:h,store:_}=e,{_:x}=i(),[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=()=>{if(!h||!D(n)||k!==null||he.current)return;he.current=!0,fe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{A(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),A({authenticated:!1,host:e})}).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]!==a||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?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],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:()=>{a.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 a.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 i;t[36]!==x||t[37]!==j||t[38]!==h?(i=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]=i):i=t[39],U=i,H=async function(){if(!(!L||!e||w)){me(null),O(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=d(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{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 r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}O(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(de),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},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,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(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`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===G?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{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)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],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]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=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)(r,{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)(r,{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)(r,{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)(r,{id:`Llyqvo`})}),(0,T.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{V()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{H()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{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)(r,{id:`fj5YiP`})})]}),(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{H()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=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)(r,{id:`UDFrWm`})}):k.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{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)(r,{id:`SgKLfA`})}),(0,T.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{U()},disabled:j,children:j?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{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)(r,{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)(r,{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{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-RQ5o7P7w.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-FGMqkFjm.js";import{an as u,sn as d}from"./dist-5ovMzVKN2.js";import{t as ie}from"./loader-circle-DJ1nzSAL.js";import{n as f}from"./dist-uN7pEWl0.js";import{t as p}from"./desktop-bridge-types-FXg4M54A.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-BlAqmJZT.js";import{t as se}from"./share-metadata-rows-CuFlpaJB.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function C(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return 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:a,cloneController:h,store:_}=e,{_:x}=i(),[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=()=>{if(!h||!D(n)||k!==null||he.current)return;he.current=!0,fe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{A(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),A({authenticated:!1,host:e})}).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]!==a||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?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],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:()=>{a.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 a.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 i;t[36]!==x||t[37]!==j||t[38]!==h?(i=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]=i):i=t[39],U=i,H=async function(){if(!(!L||!e||w)){me(null),O(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=d(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{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 r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}O(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(de),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},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,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(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`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===G?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{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)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],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]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=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)(r,{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)(r,{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)(r,{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)(r,{id:`Llyqvo`})}),(0,T.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{V()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{H()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{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)(r,{id:`fj5YiP`})})]}),(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{H()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=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)(r,{id:`UDFrWm`})}):k.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{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)(r,{id:`SgKLfA`})}),(0,T.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{U()},disabled:j,children:j?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{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)(r,{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)(r,{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{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-FGMqkFjm.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-BN0afFCO.js";import{t as p}from"./miss-dialog-store-BGDBpPYJ.js";import{f as m,p as h}from"./doc-paths-KCjzuC60.js";var g=r(),_=e(n(),1),v=t();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)(29),{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=h(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`?h(e):m(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]!==n.path||t[12]!==T?(M=()=>T(n.path),t[11]=n.path,t[12]=T,t[13]=M):M=t[13];let N;t[14]!==C||t[15]!==n||t[16]!==T||t[17]!==_||t[18]!==r||t[19]!==M?(N=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_,onPullApplied:M}),t[14]=C,t[15]=n,t[16]=T,t[17]=_,t[18]=r,t[19]=M,t[20]=N):N=t[20];let P;t[21]!==N||t[22]!==j?(P=(0,v.jsx)(o,{className:j,children:N}),t[21]=N,t[22]=j,t[23]=P):P=t[23];let F;return t[24]!==r.phase||t[25]!==P||t[26]!==O||t[27]!==A?(F=(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,P]})}),t[24]=r.phase,t[25]=P,t[26]=O,t[27]=A,t[28]=F):F=t[28],F}export{b as ShareReceiveMissDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-FGMqkFjm.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-BmcjNZOu.js";import{t as p}from"./miss-dialog-store-BGDBpPYJ.js";import{f as m,p as h}from"./doc-paths-BFNbv2er.js";var g=r(),_=e(n(),1),v=t();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)(29),{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=h(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`?h(e):m(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]!==n.path||t[12]!==T?(M=()=>T(n.path),t[11]=n.path,t[12]=T,t[13]=M):M=t[13];let N;t[14]!==C||t[15]!==n||t[16]!==T||t[17]!==_||t[18]!==r||t[19]!==M?(N=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_,onPullApplied:M}),t[14]=C,t[15]=n,t[16]=T,t[17]=_,t[18]=r,t[19]=M,t[20]=N):N=t[20];let P;t[21]!==N||t[22]!==j?(P=(0,v.jsx)(o,{className:j,children:N}),t[21]=N,t[22]=j,t[23]=P):P=t[23];let F;return t[24]!==r.phase||t[25]!==P||t[26]!==O||t[27]!==A?(F=(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,P]})}),t[24]=r.phase,t[25]=P,t[26]=O,t[27]=A,t[28]=F):F=t[28],F}export{b as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./square-pen-DbfX_rTK.js";import{a as i}from"./skill-scope-DkGQeaIH.js";import{t as a}from"./SkillModeBanner-BPmqGiVe.js";var o=n(),s=e();function c(e){let n=(0,o.c)(7),{name:c}=e,l;n[0]===c?l=n[1]:(l=i(c),n[0]=c,n[1]=l);let u;n[2]===l?u=n[3]:(u=(0,s.jsx)(`strong`,{className:`font-medium text-foreground`,children:l}),n[2]=l,n[3]=u);let d=u,f;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(r,{className:`size-4`,"aria-hidden":!0}),n[4]=f):f=n[4];let p;return n[5]===d?p=n[6]:(p=(0,s.jsx)(a,{icon:f,children:(0,s.jsx)(t,{id:`i-wHEp`,values:{boldName:d}})}),n[5]=d,n[6]=p),p}export{c as SkillEditBanner};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./square-pen-DbfX_rTK.js";import{a as i}from"./skill-scope-DwJ84s_r.js";import{t as a}from"./SkillModeBanner-BPmqGiVe.js";var o=n(),s=e();function c(e){let n=(0,o.c)(7),{name:c}=e,l;n[0]===c?l=n[1]:(l=i(c),n[0]=c,n[1]=l);let u;n[2]===l?u=n[3]:(u=(0,s.jsx)(`strong`,{className:`font-medium text-foreground`,children:l}),n[2]=l,n[3]=u);let d=u,f;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(r,{className:`size-4`,"aria-hidden":!0}),n[4]=f):f=n[4];let p;return n[5]===d?p=n[6]:(p=(0,s.jsx)(a,{icon:f,children:(0,s.jsx)(t,{id:`i-wHEp`,values:{boldName:d}})}),n[5]=d,n[6]=p),p}export{c as SkillEditBanner};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-RQ5o7P7w.js";import{i as c,n as l,t as u}from"./tooltip-x7BNUa3s.js";import{a as d,c as f,i as p,n as m,o as h,s as g,t as _}from"./dialog-FGMqkFjm.js";import{t as v}from"./switch-BuVbhbtp.js";import{t as y}from"./arrow-up-right-CxtRAecj.js";import{t as b}from"./refresh-cw-CTfHLdRW.js";import{t as x}from"./undo-2-DlBBaLMR.js";import{t as S}from"./use-skill-origin-DscI7Fo0.js";import{t as C}from"./DiffView-BBC1fcoF.js";var w=e(n(),1),T=a(),E=t();function D(e){let t=(0,T.c)(31),{open:n,onOpenChange:i,skillName:a,localBody:o,upstreamBody:c,applying:l,onTakeUpstream:u}=e,v;t[0]===a?v=t[1]:(v=(0,E.jsx)(f,{children:(0,E.jsx)(r,{id:`EPKVES`,values:{skillName:a}})}),t[0]=a,t[1]=v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,E.jsx)(d,{children:(0,E.jsx)(r,{id:`kKw0H3`})}),t[2]=y):y=t[2];let b;t[3]===v?b=t[4]:(b=(0,E.jsxs)(g,{children:[v,y]}),t[3]=v,t[4]=b);let x;t[5]!==o||t[6]!==c?(x=(0,E.jsx)(m,{className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsx)(C,{oldContent:o,newContent:c,layout:`unified`})}),t[5]=o,t[6]=c,t[7]=x):x=t[7];let S;t[8]===i?S=t[9]:(S=()=>i(!1),t[8]=i,t[9]=S);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(r,{id:`Tq3pcs`}),t[10]=w):w=t[10];let D;t[11]!==l||t[12]!==S?(D=(0,E.jsx)(s,{variant:`outline`,onClick:S,disabled:l,children:w}),t[11]=l,t[12]=S,t[13]=D):D=t[13];let O;t[14]===l?O=t[15]:(O=l?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`qkqG0b`}),t[14]=l,t[15]=O);let k;t[16]!==l||t[17]!==u||t[18]!==O?(k=(0,E.jsx)(s,{onClick:u,disabled:l,children:O}),t[16]=l,t[17]=u,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==D||t[21]!==k?(A=(0,E.jsxs)(h,{children:[D,k]}),t[20]=D,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==A||t[24]!==b||t[25]!==x?(j=(0,E.jsxs)(p,{className:`flex max-h-[85vh] max-w-3xl flex-col`,children:[b,x,A]}),t[23]=A,t[24]=b,t[25]=x,t[26]=j):j=t[26];let M;return t[27]!==i||t[28]!==n||t[29]!==j?(M=(0,E.jsx)(_,{open:n,onOpenChange:i,children:j}),t[27]=i,t[28]=n,t[29]=j,t[30]=M):M=t[30],M}function O(e){let t=(0,T.c)(48),{scope:n,name:a}=e,{_:d}=i(),f;t[0]!==a||t[1]!==n?(f={scope:n,name:a},t[0]=a,t[1]=n,t[2]=f):f=t[2];let{origin:p,github:m,displaySource:h,importedTitle:g,canReimport:_,updateAvailable:C,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=S(f),[R,z]=(0,w.useState)(null),B;t[3]!==O||t[4]!==F||t[5]!==N?(B=async function(){if(O){let e=await F();e&&z(e);return}await N()},t[3]=O,t[4]=F,t[5]=N,t[6]=B):B=t[6];let V=B,H;t[7]===N?H=t[8]:(H=async function(){await N(),z(null)},t[7]=N,t[8]=H);let U=H;if(!p)return null;let W;t[9]!==h||t[10]!==m||t[11]!==g?(W=m?(0,E.jsxs)(`a`,{href:m,target:`_blank`,rel:`noreferrer`,title:g??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:h}),(0,E.jsx)(y,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,E.jsx)(`span`,{title:g??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:h}),t[9]=h,t[10]=m,t[11]=g,t[12]=W):W=t[12];let G;t[13]!==d||t[14]!==k||t[15]!==_||t[16]!==A||t[17]!==j?(G=_?(0,E.jsxs)(u,{children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,E.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,E.jsx)(r,{id:`2M0JF6`})}),(0,E.jsx)(v,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":d({id:`o9fPtM`}),className:`scale-75`})]})}),(0,E.jsx)(l,{side:`bottom`,children:A?(0,E.jsx)(r,{id:`vy_VIN`}):k?(0,E.jsx)(r,{id:`vGQxBT`}):(0,E.jsx)(r,{id:`9p_QBN`})})]}):null,t[13]=d,t[14]=k,t[15]=_,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,E.jsxs)(u,{children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsx)(`span`,{className:`shrink-0 rounded-sm bg-amber-500/15 px-1.5 py-0.5 font-medium text-[11px] text-amber-700 dark:text-amber-400`,children:(0,E.jsx)(r,{id:`tgWuMB`})})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==d||t[22]!==_||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&_&&M?(0,E.jsxs)(u,{children:[(0,E.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":d({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(c,{children:[(0,E.jsx)(x,{className:o(`size-3`,L&&`animate-spin`),"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,E.jsx)(r,{id:`fIJtam`}):(0,E.jsx)(r,{id:`jJdwCB`})})]})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`XSb9HS`})})]}):null,t[21]=d,t[22]=_,t[23]=O,t[24]=P,t[25]=I,t[26]=M,t[27]=L,t[28]=q):q=t[28];let J;t[29]!==d||t[30]!==_||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==C?(J=_&&C?(0,E.jsxs)(u,{children:[(0,E.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":d({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(c,{children:[(0,E.jsx)(b,{className:o(`size-3`,P&&`animate-spin`),"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`EkH9pt`})})]})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`GidGkh`})})]}):null,t[29]=d,t[30]=_,t[31]=V,t[32]=P,t[33]=L,t[34]=C,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==a||t[38]!==U||t[39]!==P?(Y=R?(0,E.jsx)(D,{open:!0,onOpenChange:e=>{e||z(null)},skillName:a,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()}):null,t[36]=R,t[37]=a,t[38]=U,t[39]=P,t[40]=Y):Y=t[40];let X;return t[41]!==W||t[42]!==G||t[43]!==K||t[44]!==q||t[45]!==J||t[46]!==Y?(X=(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs`,children:[W,G,K,q,J,Y]}),t[41]=W,t[42]=G,t[43]=K,t[44]=q,t[45]=J,t[46]=Y,t[47]=X):X=t[47],X}export{O as SkillOriginInline};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-RQ5o7P7w.js";import{i as c,n as l,t as u}from"./tooltip-x7BNUa3s.js";import{a as d,c as f,i as p,n as m,o as h,s as g,t as _}from"./dialog-FGMqkFjm.js";import{t as v}from"./switch-BuVbhbtp.js";import{t as y}from"./arrow-up-right-CxtRAecj.js";import{t as b}from"./refresh-cw-CTfHLdRW.js";import{t as x}from"./undo-2-DlBBaLMR.js";import{t as S}from"./use-skill-origin-DvSOmIz_.js";import{t as C}from"./DiffView-BBC1fcoF.js";var w=e(n(),1),T=a(),E=t();function D(e){let t=(0,T.c)(31),{open:n,onOpenChange:i,skillName:a,localBody:o,upstreamBody:c,applying:l,onTakeUpstream:u}=e,v;t[0]===a?v=t[1]:(v=(0,E.jsx)(f,{children:(0,E.jsx)(r,{id:`EPKVES`,values:{skillName:a}})}),t[0]=a,t[1]=v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,E.jsx)(d,{children:(0,E.jsx)(r,{id:`kKw0H3`})}),t[2]=y):y=t[2];let b;t[3]===v?b=t[4]:(b=(0,E.jsxs)(g,{children:[v,y]}),t[3]=v,t[4]=b);let x;t[5]!==o||t[6]!==c?(x=(0,E.jsx)(m,{className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsx)(C,{oldContent:o,newContent:c,layout:`unified`})}),t[5]=o,t[6]=c,t[7]=x):x=t[7];let S;t[8]===i?S=t[9]:(S=()=>i(!1),t[8]=i,t[9]=S);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(r,{id:`Tq3pcs`}),t[10]=w):w=t[10];let D;t[11]!==l||t[12]!==S?(D=(0,E.jsx)(s,{variant:`outline`,onClick:S,disabled:l,children:w}),t[11]=l,t[12]=S,t[13]=D):D=t[13];let O;t[14]===l?O=t[15]:(O=l?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`qkqG0b`}),t[14]=l,t[15]=O);let k;t[16]!==l||t[17]!==u||t[18]!==O?(k=(0,E.jsx)(s,{onClick:u,disabled:l,children:O}),t[16]=l,t[17]=u,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==D||t[21]!==k?(A=(0,E.jsxs)(h,{children:[D,k]}),t[20]=D,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==A||t[24]!==b||t[25]!==x?(j=(0,E.jsxs)(p,{className:`flex max-h-[85vh] max-w-3xl flex-col`,children:[b,x,A]}),t[23]=A,t[24]=b,t[25]=x,t[26]=j):j=t[26];let M;return t[27]!==i||t[28]!==n||t[29]!==j?(M=(0,E.jsx)(_,{open:n,onOpenChange:i,children:j}),t[27]=i,t[28]=n,t[29]=j,t[30]=M):M=t[30],M}function O(e){let t=(0,T.c)(48),{scope:n,name:a}=e,{_:d}=i(),f;t[0]!==a||t[1]!==n?(f={scope:n,name:a},t[0]=a,t[1]=n,t[2]=f):f=t[2];let{origin:p,github:m,displaySource:h,importedTitle:g,canReimport:_,updateAvailable:C,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=S(f),[R,z]=(0,w.useState)(null),B;t[3]!==O||t[4]!==F||t[5]!==N?(B=async function(){if(O){let e=await F();e&&z(e);return}await N()},t[3]=O,t[4]=F,t[5]=N,t[6]=B):B=t[6];let V=B,H;t[7]===N?H=t[8]:(H=async function(){await N(),z(null)},t[7]=N,t[8]=H);let U=H;if(!p)return null;let W;t[9]!==h||t[10]!==m||t[11]!==g?(W=m?(0,E.jsxs)(`a`,{href:m,target:`_blank`,rel:`noreferrer`,title:g??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:h}),(0,E.jsx)(y,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,E.jsx)(`span`,{title:g??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:h}),t[9]=h,t[10]=m,t[11]=g,t[12]=W):W=t[12];let G;t[13]!==d||t[14]!==k||t[15]!==_||t[16]!==A||t[17]!==j?(G=_?(0,E.jsxs)(u,{children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,E.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,E.jsx)(r,{id:`2M0JF6`})}),(0,E.jsx)(v,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":d({id:`o9fPtM`}),className:`scale-75`})]})}),(0,E.jsx)(l,{side:`bottom`,children:A?(0,E.jsx)(r,{id:`vy_VIN`}):k?(0,E.jsx)(r,{id:`vGQxBT`}):(0,E.jsx)(r,{id:`9p_QBN`})})]}):null,t[13]=d,t[14]=k,t[15]=_,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,E.jsxs)(u,{children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsx)(`span`,{className:`shrink-0 rounded-sm bg-amber-500/15 px-1.5 py-0.5 font-medium text-[11px] text-amber-700 dark:text-amber-400`,children:(0,E.jsx)(r,{id:`tgWuMB`})})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==d||t[22]!==_||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&_&&M?(0,E.jsxs)(u,{children:[(0,E.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":d({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(c,{children:[(0,E.jsx)(x,{className:o(`size-3`,L&&`animate-spin`),"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,E.jsx)(r,{id:`fIJtam`}):(0,E.jsx)(r,{id:`jJdwCB`})})]})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`XSb9HS`})})]}):null,t[21]=d,t[22]=_,t[23]=O,t[24]=P,t[25]=I,t[26]=M,t[27]=L,t[28]=q):q=t[28];let J;t[29]!==d||t[30]!==_||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==C?(J=_&&C?(0,E.jsxs)(u,{children:[(0,E.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":d({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(c,{children:[(0,E.jsx)(b,{className:o(`size-3`,P&&`animate-spin`),"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`EkH9pt`})})]})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`GidGkh`})})]}):null,t[29]=d,t[30]=_,t[31]=V,t[32]=P,t[33]=L,t[34]=C,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==a||t[38]!==U||t[39]!==P?(Y=R?(0,E.jsx)(D,{open:!0,onOpenChange:e=>{e||z(null)},skillName:a,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()}):null,t[36]=R,t[37]=a,t[38]=U,t[39]=P,t[40]=Y):Y=t[40];let X;return t[41]!==W||t[42]!==G||t[43]!==K||t[44]!==q||t[45]!==J||t[46]!==Y?(X=(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs`,children:[W,G,K,q,J,Y]}),t[41]=W,t[42]=G,t[43]=K,t[44]=q,t[45]=J,t[46]=Y,t[47]=X):X=t[47],X}export{O as SkillOriginInline};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{c as s,l as c,r as l}from"./ChangedOutsideBadge-DVfCTGd2.js";import{t as u}from"./button-RQ5o7P7w.js";import{a as d,c as f,l as p,m,o as h,r as g,t as _,u as v}from"./dropdown-menu-AlVJ7dJz.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./select-BUOcREjn.js";import{d as E,i as D,l as O,r as k,s as A,u as j,w as M}from"./skill-actions-By3ZQhYp.js";import{t as N}from"./chevron-down-BeptYHqQ.js";import{d as P,i as F,t as I}from"./skill-scope-DkGQeaIH.js";import{t as L}from"./use-skills-B19yYlmR.js";var R=a(),z=e(n(),1),B=t();function V(e){let t=(0,R.c)(52),{scope:n,name:a}=e,{_:c}=i(),d=L(),f=k(),p;t[0]!==a||t[1]!==n||t[2]!==d.data||t[3]!==d.status?(p=d.status===`ready`?d.data.find(e=>e.scope===n&&e.name===a):void 0,t[0]=a,t[1]=n,t[2]=d.data,t[3]=d.status,t[4]=p):p=t[4];let h=p,v;t[5]!==h||t[6]!==a||t[7]!==n?(v=h??{scope:n,name:a,path:a,description:``,installed:!1,hosts:[]},t[5]=h,t[6]=a,t[7]=n,t[8]=v):v=t[8];let y=v,[b,x]=(0,z.useState)(!1),S=E(y,f),{installed:C,installing:w,hostSet:T}=S,D=h===void 0&&!C,A;t[9]!==h||t[10]!==T?(A=h?F(h,[...T]):[],t[9]=h,t[10]=T,t[11]=A):A=t[11];let M=A,P;t[12]!==f||t[13]!==y?(P=()=>f.requestFileCreate(y),t[12]=f,t[13]=y,t[14]=P):P=t[14];let I;t[15]===c?I=t[16]:(I=c({id:`leF0i_`}),t[15]=c,t[16]=I);let V;t[17]===c?V=t[18]:(V=c({id:`leF0i_`}),t[17]=c,t[18]=V);let H;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,B.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[19]=H):H=t[19];let U;t[20]!==P||t[21]!==I||t[22]!==V?(U=(0,B.jsx)(u,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:P,title:I,"aria-label":V,"data-testid":`skill-editor-new-file`,children:H}),t[20]=P,t[21]=I,t[22]=V,t[23]=U):U=t[23];let W=D?`resolving`:`installed`,G=D?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,K;t[24]===G?K=t[25]:(K=o(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,G),t[24]=G,t[25]=K);let q;t[26]!==M||t[27]!==w||t[28]!==D?(q=w?(0,B.jsx)(r,{id:`b4itZn`}):D?(0,B.jsx)(r,{id:`iKvAeG`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(r,{id:`eQkgKV`}),(0,B.jsx)(l,{hosts:M,className:`text-muted-foreground`})]}),t[26]=M,t[27]=w,t[28]=D,t[29]=q):q=t[29];let J;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,B.jsx)(N,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[30]=J):J=t[30];let Y;t[31]!==w||t[32]!==K||t[33]!==q||t[34]!==W?(Y=(0,B.jsx)(m,{asChild:!0,children:(0,B.jsxs)(u,{variant:`outline`,size:`sm`,disabled:w,"data-testid":`skill-install-menu-trigger`,"data-state":W,className:K,children:[q,J]})}),t[31]=w,t[32]=K,t[33]=q,t[34]=W,t[35]=Y):Y=t[35];let X;t[36]!==f||t[37]!==y?(X=e=>f.requestForkResolve(y,e),t[36]=f,t[37]=y,t[38]=X):X=t[38];let Z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Z=()=>x(!1),t[39]=Z):Z=t[39];let Q;t[40]!==y||t[41]!==X||t[42]!==S?(Q=(0,B.jsx)(g,{align:`end`,className:O,children:(0,B.jsx)(j,{toggles:S,skill:y,onResolveFork:X,onRunStart:Z})}),t[40]=y,t[41]=X,t[42]=S,t[43]=Q):Q=t[43];let $;t[44]!==b||t[45]!==Y||t[46]!==Q?($=(0,B.jsxs)(_,{open:b,onOpenChange:x,children:[Y,Q]}),t[44]=b,t[45]=Y,t[46]=Q,t[47]=$):$=t[47];let ee;return t[48]!==f.dialogs||t[49]!==$||t[50]!==U?(ee=(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[U,$,f.dialogs]}),t[48]=f.dialogs,t[49]=$,t[50]=U,t[51]=ee):ee=t[51],ee}function H(e){let t=(0,R.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=P(),d;t[0]===a?d=t[1]:(d=e=>a(e),t[0]=a,t[1]=d);let f;t[2]===l?f=t[3]:(f=l({id:`oCHfGC`}),t[2]=l,t[3]=f);let p;t[4]===c?p=t[5]:(p=o(`w-auto gap-1 text-xs font-mono uppercase`,c),t[4]=c,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,B.jsx)(w,{}),t[6]=m):m=t[6];let h;t[7]!==f||t[8]!==p?(h=(0,B.jsx)(S,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:m}),t[7]=f,t[8]=p,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,B.jsx)(y,{children:(0,B.jsx)(r,{id:`oCHfGC`})}),t[10]=g):g=t[10];let _;t[11]===u?_=t[12]:(_=I.map(e=>(0,B.jsx)(b,{value:e,children:u[e]},e)),t[11]=u,t[12]=_);let v;t[13]===_?v=t[14]:(v=(0,B.jsx)(x,{align:`end`,children:(0,B.jsxs)(C,{children:[g,_]})}),t[13]=_,t[14]=v);let E;return t[15]!==s||t[16]!==d||t[17]!==h||t[18]!==v||t[19]!==n?(E=(0,B.jsxs)(T,{value:n,onValueChange:d,disabled:s,children:[h,v]}),t[15]=s,t[16]=d,t[17]=h,t[18]=v,t[19]=n,t[20]=E):E=t[20],E}function U(e){let t=(0,R.c)(12),{scope:n,name:r}=e,[i,a]=(0,z.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,B.jsx)(D,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function W(e){let t=(0,R.c)(45),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:l,problemMessages:y}=e,{_:b}=i(),x=P(),S;t[0]!==a||t[1]!==n?(S={scope:n,name:a},t[0]=a,t[1]=n,t[2]=S):S=t[2];let C=U(S),w;t[3]!==C.requestMove||t[4]!==n?(w=(0,B.jsx)(H,{value:n,onRequestMove:C.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=C.requestMove,t[4]=n,t[5]=w):w=t[5];let T;t[6]!==a||t[7]!==n?(T=(0,B.jsx)(V,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=T):T=t[8];let E;t[9]!==w||t[10]!==T?(E=(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w,T]}),t[9]=w,t[10]=T,t[11]=E):E=t[11];let D;t[12]!==s||t[13]!==l||t[14]!==y||t[15]!==o?(D=o?(0,B.jsx)(A,{onAddProperty:s,problemCount:l,problemMessages:y,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=l,t[14]=y,t[15]=o,t[16]=D):D=t[16];let O;t[17]===b?O=t[18]:(O=b({id:`Yzs3QX`}),t[17]=b,t[18]=O);let k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,B.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[19]=k):k=t[19];let j;t[20]===O?j=t[21]:(j=(0,B.jsx)(m,{asChild:!0,children:(0,B.jsx)(u,{variant:`ghost`,size:`icon`,"aria-label":O,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:k})}),t[20]=O,t[21]=j);let N;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,B.jsx)(h,{children:(0,B.jsx)(r,{id:`oCHfGC`})}),t[22]=N):N=t[22];let F;t[23]===C?F=t[24]:(F=e=>C.requestMove(e),t[23]=C,t[24]=F);let L;t[25]===x?L=t[26]:(L=I.map(e=>(0,B.jsx)(p,{value:e,children:x[e]},e)),t[25]=x,t[26]=L);let z;t[27]!==n||t[28]!==F||t[29]!==L?(z=(0,B.jsx)(f,{value:n,onValueChange:F,children:L}),t[27]=n,t[28]=F,t[29]=L,t[30]=z):z=t[30];let W;t[31]!==s||t[32]!==o?(W=o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{}),(0,B.jsxs)(d,{onSelect:s,children:[(0,B.jsx)(M,{}),(0,B.jsx)(r,{id:`81H_23`})]})]}):null,t[31]=s,t[32]=o,t[33]=W):W=t[33];let G;t[34]!==z||t[35]!==W?(G=(0,B.jsxs)(g,{align:`end`,className:`min-w-44`,children:[N,z,W]}),t[34]=z,t[35]=W,t[36]=G):G=t[36];let K;t[37]!==G||t[38]!==j?(K=(0,B.jsxs)(_,{children:[j,G]}),t[37]=G,t[38]=j,t[39]=K):K=t[39];let q;return t[40]!==C.dialog||t[41]!==K||t[42]!==E||t[43]!==D?(q=(0,B.jsxs)(B.Fragment,{children:[E,D,K,C.dialog]}),t[40]=C.dialog,t[41]=K,t[42]=E,t[43]=D,t[44]=q):q=t[44],q}export{W as SkillToolbarControls};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{c as s,l as c,r as l}from"./ChangedOutsideBadge-eT1ODdAD.js";import{t as u}from"./button-RQ5o7P7w.js";import{a as d,c as f,l as p,m,o as h,r as g,t as _,u as v}from"./dropdown-menu-AlVJ7dJz.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./select-BUOcREjn.js";import{d as E,i as D,l as O,r as k,s as A,u as j,w as M}from"./skill-actions-CfQkZqK6.js";import{t as N}from"./chevron-down-BeptYHqQ.js";import{d as P,i as F,t as I}from"./skill-scope-DwJ84s_r.js";import{t as L}from"./use-skills-DcLUuUJ9.js";var R=a(),z=e(n(),1),B=t();function V(e){let t=(0,R.c)(52),{scope:n,name:a}=e,{_:c}=i(),d=L(),f=k(),p;t[0]!==a||t[1]!==n||t[2]!==d.data||t[3]!==d.status?(p=d.status===`ready`?d.data.find(e=>e.scope===n&&e.name===a):void 0,t[0]=a,t[1]=n,t[2]=d.data,t[3]=d.status,t[4]=p):p=t[4];let h=p,v;t[5]!==h||t[6]!==a||t[7]!==n?(v=h??{scope:n,name:a,path:a,description:``,installed:!1,hosts:[]},t[5]=h,t[6]=a,t[7]=n,t[8]=v):v=t[8];let y=v,[b,x]=(0,z.useState)(!1),S=E(y,f),{installed:C,installing:w,hostSet:T}=S,D=h===void 0&&!C,A;t[9]!==h||t[10]!==T?(A=h?F(h,[...T]):[],t[9]=h,t[10]=T,t[11]=A):A=t[11];let M=A,P;t[12]!==f||t[13]!==y?(P=()=>f.requestFileCreate(y),t[12]=f,t[13]=y,t[14]=P):P=t[14];let I;t[15]===c?I=t[16]:(I=c({id:`leF0i_`}),t[15]=c,t[16]=I);let V;t[17]===c?V=t[18]:(V=c({id:`leF0i_`}),t[17]=c,t[18]=V);let H;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,B.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[19]=H):H=t[19];let U;t[20]!==P||t[21]!==I||t[22]!==V?(U=(0,B.jsx)(u,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:P,title:I,"aria-label":V,"data-testid":`skill-editor-new-file`,children:H}),t[20]=P,t[21]=I,t[22]=V,t[23]=U):U=t[23];let W=D?`resolving`:`installed`,G=D?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,K;t[24]===G?K=t[25]:(K=o(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,G),t[24]=G,t[25]=K);let q;t[26]!==M||t[27]!==w||t[28]!==D?(q=w?(0,B.jsx)(r,{id:`b4itZn`}):D?(0,B.jsx)(r,{id:`iKvAeG`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(r,{id:`eQkgKV`}),(0,B.jsx)(l,{hosts:M,className:`text-muted-foreground`})]}),t[26]=M,t[27]=w,t[28]=D,t[29]=q):q=t[29];let J;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,B.jsx)(N,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[30]=J):J=t[30];let Y;t[31]!==w||t[32]!==K||t[33]!==q||t[34]!==W?(Y=(0,B.jsx)(m,{asChild:!0,children:(0,B.jsxs)(u,{variant:`outline`,size:`sm`,disabled:w,"data-testid":`skill-install-menu-trigger`,"data-state":W,className:K,children:[q,J]})}),t[31]=w,t[32]=K,t[33]=q,t[34]=W,t[35]=Y):Y=t[35];let X;t[36]!==f||t[37]!==y?(X=e=>f.requestForkResolve(y,e),t[36]=f,t[37]=y,t[38]=X):X=t[38];let Z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Z=()=>x(!1),t[39]=Z):Z=t[39];let Q;t[40]!==y||t[41]!==X||t[42]!==S?(Q=(0,B.jsx)(g,{align:`end`,className:O,children:(0,B.jsx)(j,{toggles:S,skill:y,onResolveFork:X,onRunStart:Z})}),t[40]=y,t[41]=X,t[42]=S,t[43]=Q):Q=t[43];let $;t[44]!==b||t[45]!==Y||t[46]!==Q?($=(0,B.jsxs)(_,{open:b,onOpenChange:x,children:[Y,Q]}),t[44]=b,t[45]=Y,t[46]=Q,t[47]=$):$=t[47];let ee;return t[48]!==f.dialogs||t[49]!==$||t[50]!==U?(ee=(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[U,$,f.dialogs]}),t[48]=f.dialogs,t[49]=$,t[50]=U,t[51]=ee):ee=t[51],ee}function H(e){let t=(0,R.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=P(),d;t[0]===a?d=t[1]:(d=e=>a(e),t[0]=a,t[1]=d);let f;t[2]===l?f=t[3]:(f=l({id:`oCHfGC`}),t[2]=l,t[3]=f);let p;t[4]===c?p=t[5]:(p=o(`w-auto gap-1 text-xs font-mono uppercase`,c),t[4]=c,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,B.jsx)(w,{}),t[6]=m):m=t[6];let h;t[7]!==f||t[8]!==p?(h=(0,B.jsx)(S,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:m}),t[7]=f,t[8]=p,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,B.jsx)(y,{children:(0,B.jsx)(r,{id:`oCHfGC`})}),t[10]=g):g=t[10];let _;t[11]===u?_=t[12]:(_=I.map(e=>(0,B.jsx)(b,{value:e,children:u[e]},e)),t[11]=u,t[12]=_);let v;t[13]===_?v=t[14]:(v=(0,B.jsx)(x,{align:`end`,children:(0,B.jsxs)(C,{children:[g,_]})}),t[13]=_,t[14]=v);let E;return t[15]!==s||t[16]!==d||t[17]!==h||t[18]!==v||t[19]!==n?(E=(0,B.jsxs)(T,{value:n,onValueChange:d,disabled:s,children:[h,v]}),t[15]=s,t[16]=d,t[17]=h,t[18]=v,t[19]=n,t[20]=E):E=t[20],E}function U(e){let t=(0,R.c)(12),{scope:n,name:r}=e,[i,a]=(0,z.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,B.jsx)(D,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function W(e){let t=(0,R.c)(45),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:l,problemMessages:y}=e,{_:b}=i(),x=P(),S;t[0]!==a||t[1]!==n?(S={scope:n,name:a},t[0]=a,t[1]=n,t[2]=S):S=t[2];let C=U(S),w;t[3]!==C.requestMove||t[4]!==n?(w=(0,B.jsx)(H,{value:n,onRequestMove:C.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=C.requestMove,t[4]=n,t[5]=w):w=t[5];let T;t[6]!==a||t[7]!==n?(T=(0,B.jsx)(V,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=T):T=t[8];let E;t[9]!==w||t[10]!==T?(E=(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w,T]}),t[9]=w,t[10]=T,t[11]=E):E=t[11];let D;t[12]!==s||t[13]!==l||t[14]!==y||t[15]!==o?(D=o?(0,B.jsx)(A,{onAddProperty:s,problemCount:l,problemMessages:y,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=l,t[14]=y,t[15]=o,t[16]=D):D=t[16];let O;t[17]===b?O=t[18]:(O=b({id:`Yzs3QX`}),t[17]=b,t[18]=O);let k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,B.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[19]=k):k=t[19];let j;t[20]===O?j=t[21]:(j=(0,B.jsx)(m,{asChild:!0,children:(0,B.jsx)(u,{variant:`ghost`,size:`icon`,"aria-label":O,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:k})}),t[20]=O,t[21]=j);let N;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,B.jsx)(h,{children:(0,B.jsx)(r,{id:`oCHfGC`})}),t[22]=N):N=t[22];let F;t[23]===C?F=t[24]:(F=e=>C.requestMove(e),t[23]=C,t[24]=F);let L;t[25]===x?L=t[26]:(L=I.map(e=>(0,B.jsx)(p,{value:e,children:x[e]},e)),t[25]=x,t[26]=L);let z;t[27]!==n||t[28]!==F||t[29]!==L?(z=(0,B.jsx)(f,{value:n,onValueChange:F,children:L}),t[27]=n,t[28]=F,t[29]=L,t[30]=z):z=t[30];let W;t[31]!==s||t[32]!==o?(W=o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{}),(0,B.jsxs)(d,{onSelect:s,children:[(0,B.jsx)(M,{}),(0,B.jsx)(r,{id:`81H_23`})]})]}):null,t[31]=s,t[32]=o,t[33]=W):W=t[33];let G;t[34]!==z||t[35]!==W?(G=(0,B.jsxs)(g,{align:`end`,className:`min-w-44`,children:[N,z,W]}),t[34]=z,t[35]=W,t[36]=G):G=t[36];let K;t[37]!==G||t[38]!==j?(K=(0,B.jsxs)(_,{children:[j,G]}),t[37]=G,t[38]=j,t[39]=K):K=t[39];let q;return t[40]!==C.dialog||t[41]!==K||t[42]!==E||t[43]!==D?(q=(0,B.jsxs)(B.Fragment,{children:[E,D,K,C.dialog]}),t[40]=C.dialog,t[41]=K,t[42]=E,t[43]=D,t[44]=q):q=t[44],q}export{W as SkillToolbarControls};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{D as n,H as r,It as i,L as a,Rt as o,U as s,V as c,at as l,ot as u,pt as ee,vt as d,z as f}from"./DocumentContext-B0g_vd8N.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{E as g,a as te,i as ne,o as re}from"./CodeMirrorPropInput-DmM8F7PJ.js";import{Fa as _,Ii as ie,T as ae,Ta as v,ei as oe,wr as y,ya as b}from"./dist-DIn3VYDc2.js";import{O as se,P as ce,T as le,c as ue,j as de,k as fe,n as pe,r as me,x,y as he}from"./typing-burst-detector-DDN6b6N7.js";import{f as S,g as C}from"./doc-paths-KCjzuC60.js";import{v as ge}from"./use-settings-route-CYvmk4XT.js";import{G as w}from"./navigation-targets-BDSeZX3c.js";import"./config-provider-CKct7q_G.js";import{n as _e}from"./config-context-CdjtvoAz.js";import{Dt as T,E,Et as D,Ft as O,It as k,J as A,Ot as ve,P as j,Q as M,X as N,_ as P,ct as F,dt as ye,ft as I,ht as L,l as R,lt as z,mt as be,nt as B,rt as V,st as H,tt as U,y as W}from"./dist-BNDNcytQ.js";import{a as xe,n as G}from"./cm-theme-BCzjFmR8.js";import{i as K,n as q,o as J,r as Y}from"./dist-7c4LkvyR.js";import{o as Se,r as Ce}from"./selection-context-BgucOSM-.js";import{l as we}from"./lint-config-client-D7DpNIwn.js";import{a as Te,i as X,n as Ee,o as De,r as Oe,t as ke}from"./dist-BSFcbUmR.js";import{n as Ae,t as je}from"./src-C_O1F_4l.js";var Z=e(p(),1),Me=h();function Ne(){let e=s();return e===null?null:new Set(e.keys())}function Pe(e,t,n){let r=[],i=j(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);v.lastIndex=0;for(let e=v.exec(t);e!==null;e=v.exec(t)){let t=e[2];if(!_(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(A.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&_(c)&&n!=null)return r.push(A.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=f.exec(s);if(l)return r.push(A.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),A.set(r)}function Fe(e){let t=r(e);return t===null?[]:[M.fromClass(class{decorations;constructor(e){this.decorations=Pe(e.state,e.visibleRanges,Ne())}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=Pe(e.view.state,e.view.visibleRanges,Ne()))}},{decorations:e=>e.decorations}),N.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),i=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(i!==void 0){n.preventDefault();let e=s()?.get(i);return window.location.hash=e===void 0?C():S(w({scope:e.scope,name:i,path:e.path})),!0}let a=n.target?.closest?.(`.cm-skill-path-link`),o=a instanceof HTMLElement?a.dataset.skillPath:void 0;return o===void 0?!1:(n.preventDefault(),window.location.hash=c(t,e,o),!0)}})]}function Ie(e,t){return e.enabled?[ke(),Oe(async n=>Le(n.state.doc,await y(n.state.doc.toString(),e,t)),{delay:600})]:[]}function Q(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function Le(e,t){let n=[];for(let r of t){let t=Q(e,r.range.start),i=Q(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=Re(r);o&&(a.actions=[o]),n.push(a)}return n}function Re(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:Q(n,e.range.start),to:Q(n,e.range.end),insert:e.newText}))})}}}var ze=[I(),F(),z(),P(),B(),V(),ve.allowMultipleSelections.of(!0),E(),R(),Y(),q(),L(),U(),H(),X(),ye.of([...K,...G,...De,...W,...J,...Ee])],Be=A.mark({class:`cm-link-ref-broken`}),Ve=/^\s{0,3}\[([^\]]+)\]:\s/,He=/\[([^\]]*)\]\[([^\]]*)\]/g,Ue=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function $(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function We(e){let t=[];return j(e).iterate({enter(e){if(Ue.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function Ge(e){let t=new Set,n=[],r=e.doc,i=We(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if($(n.from,i))continue;let a=Ve.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!$(t.from,i)&&!Ve.test(t.text))for(He.lastIndex=0;;){let e=He.exec(t.text);if(!e)break;let r=t.from+e.index;if($(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(Be.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),A.set(a)}var Ke=k.define({create(e){return Ge(e)},update(e,t){return t.docChanged?Ge(t.state):e},provide:e=>N.decorations.from(e)}),qe=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Je=A.mark({class:`cm-del`}),Ye=A.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),Xe=A.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function Ze(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Qe(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!b.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(b.test(r.text))return{from:t.from,to:r.to}}return null}function $e(e,t){let n=[],r=j(e),i=Qe(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(Je.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=qe.exec(r.text),a=i?i[1].length:2,o=A.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=Ze(r.text),a=A.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(Ye.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(Xe.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(Xe.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),A.set(n)}var et=class{decorations;constructor(e){this.decorations=$e(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=$e(e.view.state,e.view.visibleRanges))}},tt=M.fromClass(et,{decorations:e=>e.decorations});function nt(){return[tt,Ke]}var rt=t(),it=56,at=O.define();function ot(e,t,n){let r=x(e.state.doc)[t.index];r&&d(n,()=>{e.dispatch({selection:T.cursor(r.from),effects:N.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function st(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);d(r,()=>{e.dispatch({selection:T.cursor(a),effects:N.scrollIntoView(a,{y:`center`})}),e.focus()})})}function ct(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);d(n,()=>{e.dispatch({selection:T.cursor(o),effects:N.scrollIntoView(o,{y:`start`})}),e.focus()})}function lt(e){let t=(0,Me.c)(50),{docName:r,ytext:s,provider:c,placeholder:d,isSourceModeActive:f}=e,p=(0,Z.useRef)(null),h=(0,Z.useRef)(null),[g,_]=(0,Z.useState)(null);if(g)throw g;let{resolvedTheme:v}=m(),{merged:y}=_e(),b=(0,Z.useRef)(f),x=y?.editor?.wordWrap??!0,{data:S}=we(r),C;t[0]!==S?.effective||t[1]!==y?(C=S?.effective??(y?.contentRules?oe(y.contentRules):ae),t[0]=S?.effective,t[1]=y,t[2]=C):C=t[2];let w=C,T;t[3]===w?T=t[4]:(T=JSON.stringify(w),t[3]=w,t[4]=T);let E=T,O,k;t[5]===f?(O=t[6],k=t[7]):(O=()=>{b.current=f},k=[f],t[5]=f,t[6]=O,t[7]=k),(0,Z.useEffect)(O,k);let A=(0,Z.useRef)(null),j;t[8]!==r||t[9]!==w||t[10]!==d||t[11]!==c||t[12]!==v||t[13]!==x||t[14]!==s?(j=()=>{let e=p.current;if(!e)return;let t=c.configuration.name??``,f,m=dt;try{f=l({docName:t,container:e,sizeStats:{viewCount:0,bytes:s.length},factory:e=>{let i=null,o=n({ydoc:c.document,ytext:s}),l=new D,u=new D,f=new D,p=new D,h=new N({state:ve.create({doc:s.toString(),extensions:[ze,Te({scrollToMatch:e=>ee(t)?N.scrollIntoView(e,{y:`start`}):at.of(null)}),ye.of([xe]),je(s,c.awareness),ye.of(Ae),...ne({themeCompartment:l,resolvedTheme:v,ydoc:c.document,wordWrapCompartment:u,wordWrap:x,currentDocName:t}),nt(),Fe(t),ce(),p.of(Ie(w,r)),o,N.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,pe(t,`source`,me(e.view)),Ce(t,`source`,Se(e.view,t))},120))}),N.domEventHandlers({keydown:(e,t)=>!b.current||!ie()||!ge(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),a(),!0)}),f.of(be(d??``)),N.theme({"&":{height:`100%`}}),N.scrollMargins.of(ut)]}),parent:e});pe(t,`source`,me(h)),Ce(t,`source`,Se(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,m),g.addEventListener(`paste`,m),g.addEventListener(`drop`,m),g.addEventListener(`cut`,m),{view:h,ydoc:c.document,ytext:s,provider:c,themeCompartment:l,wordWrapCompartment:u,placeholderCompartment:f,lintCompartment:p}}}),A.current=f,h.current=f.view,i(r,f.view)}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),A.current=null,h.current=null,_(t instanceof Error?t:Error(String(t)))}return()=>{let e=A.current;e&&(u(e),o(r,e.view)),A.current=null,h.current=null}},t[8]=r,t[9]=w,t[10]=d,t[11]=c,t[12]=v,t[13]=x,t[14]=s,t[15]=j):j=t[15];let M;t[16]!==c||t[17]!==s?(M=[s,c],t[16]=c,t[17]=s,t[18]=M):M=t[18],(0,Z.useEffect)(j,M);let P,F;t[19]===r?(P=t[20],F=t[21]):(P=()=>{},F=[r],t[19]=r,t[20]=P,t[21]=F),(0,Z.useEffect)(P,F);let I,L;t[22]===v?(I=t[23],L=t[24]):(L=()=>{let e=A.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(v===`dark`?te:re)})},I=[v],t[22]=v,t[23]=I,t[24]=L),(0,Z.useEffect)(L,I);let R,z;t[25]===x?(R=t[26],z=t[27]):(R=()=>{let e=A.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?N.lineWrapping:[])})},z=[x],t[25]=x,t[26]=R,t[27]=z),(0,Z.useEffect)(R,z);let B,V;t[28]===d?(B=t[29],V=t[30]):(B=()=>{let e=A.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(be(d??``))})},V=[d],t[28]=d,t[29]=B,t[30]=V),(0,Z.useEffect)(B,V);let H;t[31]!==r||t[32]!==w?(H=()=>{let e=A.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(Ie(w,r))})},t[31]=r,t[32]=w,t[33]=H):H=t[33];let U;t[34]===E?U=t[35]:(U=[E],t[34]=E,t[35]=U),(0,Z.useEffect)(H,U);let W,G;t[36]!==r||t[37]!==f?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!f)return;let n=h.current;n&&(ot(n,t,r),se(r))};return window.addEventListener(he,e),()=>window.removeEventListener(he,e)},G=[r,f],t[36]=r,t[37]=f,t[38]=W,t[39]=G):(W=t[38],G=t[39]),(0,Z.useEffect)(W,G);let K,q;t[40]!==r||t[41]!==f?(K=()=>{let e=function(e){let t=e.detail;if(!t||!f)return;let n=h.current;n&&(ct(n,t,r),se(r))};return window.addEventListener(ue,e),()=>window.removeEventListener(ue,e)},q=[r,f],t[40]=r,t[41]=f,t[42]=K,t[43]=q):(K=t[42],q=t[43]),(0,Z.useEffect)(K,q);let J,Y;t[44]!==r||t[45]!==f||t[46]!==c?(J=()=>{if(!f)return;let e=h.current;if(!e)return;let t=de(r);if(!t)return;if(t.kind!==`selection-offset`){fe(r),t.kind===`outline`?ot(e,t.detail,r):t.kind===`lint`?ct(e,t.detail,r):t.kind===`raw-mdx`&&st(e,t.detail,()=>b.current,r);return}let n=!1,i=null;return queueMicrotask(()=>{if(n)return;let t=de(r);t?.kind===`selection-offset`&&(i=le({view:e,docName:r,navigation:t,ydoc:c.document,transition:{from:`wysiwyg`,to:`source`}}),i&&fe(r))}),()=>{n=!0,i?.cancel(`mode-flip`)}},Y=[r,f,c],t[44]=r,t[45]=f,t[46]=c,t[47]=J,t[48]=Y):(J=t[47],Y=t[48]),(0,Z.useEffect)(J,Y);let X;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,rt.jsx)(`div`,{ref:p,className:`source-editor h-full pb-3`}),t[49]=X):X=t[49],X}function ut(){return{top:it}}function dt(){return g()}export{lt as SourceEditor,st as applyRawMdxNavigation};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{D as n,H as r,It as i,L as a,Rt as o,U as s,V as c,at as l,ot as u,pt as ee,vt as d,z as f}from"./DocumentContext-DD95gIt4.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{E as g,a as te,i as ne,o as re}from"./CodeMirrorPropInput-L7fbBlLy.js";import{Fa as _,Ii as ie,T as ae,Ta as v,ei as oe,wr as y,ya as b}from"./dist-5ovMzVKN2.js";import{O as se,P as ce,T as le,c as ue,j as de,k as fe,n as pe,r as me,x,y as he}from"./typing-burst-detector-B4AQIJp7.js";import{f as S,g as C}from"./doc-paths-BFNbv2er.js";import{v as ge}from"./use-settings-route-BnOIfxuB.js";import{G as w}from"./navigation-targets-D9VW9WdW.js";import"./config-provider-Cb43FIW2.js";import{n as _e}from"./config-context-B2fceTMP.js";import{Dt as T,E,Et as D,Ft as O,It as k,J as A,Ot as ve,P as j,Q as M,X as N,_ as P,ct as F,dt as ye,ft as I,ht as L,l as R,lt as z,mt as be,nt as B,rt as V,st as H,tt as U,y as W}from"./dist-BNDNcytQ.js";import{a as xe,n as G}from"./cm-theme-BCzjFmR8.js";import{i as K,n as q,o as J,r as Y}from"./dist-7c4LkvyR.js";import{o as Se,r as Ce}from"./selection-context-DJvv-kK_.js";import{l as we}from"./lint-config-client-DDxBMTZk.js";import{a as Te,i as X,n as Ee,o as De,r as Oe,t as ke}from"./dist-BSFcbUmR.js";import{n as Ae,t as je}from"./src-hNXjwMT1.js";var Z=e(p(),1),Me=h();function Ne(){let e=s();return e===null?null:new Set(e.keys())}function Pe(e,t,n){let r=[],i=j(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);v.lastIndex=0;for(let e=v.exec(t);e!==null;e=v.exec(t)){let t=e[2];if(!_(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(A.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&_(c)&&n!=null)return r.push(A.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=f.exec(s);if(l)return r.push(A.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),A.set(r)}function Fe(e){let t=r(e);return t===null?[]:[M.fromClass(class{decorations;constructor(e){this.decorations=Pe(e.state,e.visibleRanges,Ne())}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=Pe(e.view.state,e.view.visibleRanges,Ne()))}},{decorations:e=>e.decorations}),N.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),i=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(i!==void 0){n.preventDefault();let e=s()?.get(i);return window.location.hash=e===void 0?C():S(w({scope:e.scope,name:i,path:e.path})),!0}let a=n.target?.closest?.(`.cm-skill-path-link`),o=a instanceof HTMLElement?a.dataset.skillPath:void 0;return o===void 0?!1:(n.preventDefault(),window.location.hash=c(t,e,o),!0)}})]}function Ie(e,t){return e.enabled?[ke(),Oe(async n=>Le(n.state.doc,await y(n.state.doc.toString(),e,t)),{delay:600})]:[]}function Q(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function Le(e,t){let n=[];for(let r of t){let t=Q(e,r.range.start),i=Q(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=Re(r);o&&(a.actions=[o]),n.push(a)}return n}function Re(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:Q(n,e.range.start),to:Q(n,e.range.end),insert:e.newText}))})}}}var ze=[I(),F(),z(),P(),B(),V(),ve.allowMultipleSelections.of(!0),E(),R(),Y(),q(),L(),U(),H(),X(),ye.of([...K,...G,...De,...W,...J,...Ee])],Be=A.mark({class:`cm-link-ref-broken`}),Ve=/^\s{0,3}\[([^\]]+)\]:\s/,He=/\[([^\]]*)\]\[([^\]]*)\]/g,Ue=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function $(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function We(e){let t=[];return j(e).iterate({enter(e){if(Ue.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function Ge(e){let t=new Set,n=[],r=e.doc,i=We(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if($(n.from,i))continue;let a=Ve.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!$(t.from,i)&&!Ve.test(t.text))for(He.lastIndex=0;;){let e=He.exec(t.text);if(!e)break;let r=t.from+e.index;if($(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(Be.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),A.set(a)}var Ke=k.define({create(e){return Ge(e)},update(e,t){return t.docChanged?Ge(t.state):e},provide:e=>N.decorations.from(e)}),qe=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Je=A.mark({class:`cm-del`}),Ye=A.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),Xe=A.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function Ze(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Qe(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!b.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(b.test(r.text))return{from:t.from,to:r.to}}return null}function $e(e,t){let n=[],r=j(e),i=Qe(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(Je.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=qe.exec(r.text),a=i?i[1].length:2,o=A.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=Ze(r.text),a=A.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(Ye.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(Xe.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(Xe.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),A.set(n)}var et=class{decorations;constructor(e){this.decorations=$e(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=$e(e.view.state,e.view.visibleRanges))}},tt=M.fromClass(et,{decorations:e=>e.decorations});function nt(){return[tt,Ke]}var rt=t(),it=56,at=O.define();function ot(e,t,n){let r=x(e.state.doc)[t.index];r&&d(n,()=>{e.dispatch({selection:T.cursor(r.from),effects:N.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function st(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);d(r,()=>{e.dispatch({selection:T.cursor(a),effects:N.scrollIntoView(a,{y:`center`})}),e.focus()})})}function ct(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);d(n,()=>{e.dispatch({selection:T.cursor(o),effects:N.scrollIntoView(o,{y:`start`})}),e.focus()})}function lt(e){let t=(0,Me.c)(50),{docName:r,ytext:s,provider:c,placeholder:d,isSourceModeActive:f}=e,p=(0,Z.useRef)(null),h=(0,Z.useRef)(null),[g,_]=(0,Z.useState)(null);if(g)throw g;let{resolvedTheme:v}=m(),{merged:y}=_e(),b=(0,Z.useRef)(f),x=y?.editor?.wordWrap??!0,{data:S}=we(r),C;t[0]!==S?.effective||t[1]!==y?(C=S?.effective??(y?.contentRules?oe(y.contentRules):ae),t[0]=S?.effective,t[1]=y,t[2]=C):C=t[2];let w=C,T;t[3]===w?T=t[4]:(T=JSON.stringify(w),t[3]=w,t[4]=T);let E=T,O,k;t[5]===f?(O=t[6],k=t[7]):(O=()=>{b.current=f},k=[f],t[5]=f,t[6]=O,t[7]=k),(0,Z.useEffect)(O,k);let A=(0,Z.useRef)(null),j;t[8]!==r||t[9]!==w||t[10]!==d||t[11]!==c||t[12]!==v||t[13]!==x||t[14]!==s?(j=()=>{let e=p.current;if(!e)return;let t=c.configuration.name??``,f,m=dt;try{f=l({docName:t,container:e,sizeStats:{viewCount:0,bytes:s.length},factory:e=>{let i=null,o=n({ydoc:c.document,ytext:s}),l=new D,u=new D,f=new D,p=new D,h=new N({state:ve.create({doc:s.toString(),extensions:[ze,Te({scrollToMatch:e=>ee(t)?N.scrollIntoView(e,{y:`start`}):at.of(null)}),ye.of([xe]),je(s,c.awareness),ye.of(Ae),...ne({themeCompartment:l,resolvedTheme:v,ydoc:c.document,wordWrapCompartment:u,wordWrap:x,currentDocName:t}),nt(),Fe(t),ce(),p.of(Ie(w,r)),o,N.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,pe(t,`source`,me(e.view)),Ce(t,`source`,Se(e.view,t))},120))}),N.domEventHandlers({keydown:(e,t)=>!b.current||!ie()||!ge(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),a(),!0)}),f.of(be(d??``)),N.theme({"&":{height:`100%`}}),N.scrollMargins.of(ut)]}),parent:e});pe(t,`source`,me(h)),Ce(t,`source`,Se(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,m),g.addEventListener(`paste`,m),g.addEventListener(`drop`,m),g.addEventListener(`cut`,m),{view:h,ydoc:c.document,ytext:s,provider:c,themeCompartment:l,wordWrapCompartment:u,placeholderCompartment:f,lintCompartment:p}}}),A.current=f,h.current=f.view,i(r,f.view)}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),A.current=null,h.current=null,_(t instanceof Error?t:Error(String(t)))}return()=>{let e=A.current;e&&(u(e),o(r,e.view)),A.current=null,h.current=null}},t[8]=r,t[9]=w,t[10]=d,t[11]=c,t[12]=v,t[13]=x,t[14]=s,t[15]=j):j=t[15];let M;t[16]!==c||t[17]!==s?(M=[s,c],t[16]=c,t[17]=s,t[18]=M):M=t[18],(0,Z.useEffect)(j,M);let P,F;t[19]===r?(P=t[20],F=t[21]):(P=()=>{},F=[r],t[19]=r,t[20]=P,t[21]=F),(0,Z.useEffect)(P,F);let I,L;t[22]===v?(I=t[23],L=t[24]):(L=()=>{let e=A.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(v===`dark`?te:re)})},I=[v],t[22]=v,t[23]=I,t[24]=L),(0,Z.useEffect)(L,I);let R,z;t[25]===x?(R=t[26],z=t[27]):(R=()=>{let e=A.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?N.lineWrapping:[])})},z=[x],t[25]=x,t[26]=R,t[27]=z),(0,Z.useEffect)(R,z);let B,V;t[28]===d?(B=t[29],V=t[30]):(B=()=>{let e=A.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(be(d??``))})},V=[d],t[28]=d,t[29]=B,t[30]=V),(0,Z.useEffect)(B,V);let H;t[31]!==r||t[32]!==w?(H=()=>{let e=A.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(Ie(w,r))})},t[31]=r,t[32]=w,t[33]=H):H=t[33];let U;t[34]===E?U=t[35]:(U=[E],t[34]=E,t[35]=U),(0,Z.useEffect)(H,U);let W,G;t[36]!==r||t[37]!==f?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!f)return;let n=h.current;n&&(ot(n,t,r),se(r))};return window.addEventListener(he,e),()=>window.removeEventListener(he,e)},G=[r,f],t[36]=r,t[37]=f,t[38]=W,t[39]=G):(W=t[38],G=t[39]),(0,Z.useEffect)(W,G);let K,q;t[40]!==r||t[41]!==f?(K=()=>{let e=function(e){let t=e.detail;if(!t||!f)return;let n=h.current;n&&(ct(n,t,r),se(r))};return window.addEventListener(ue,e),()=>window.removeEventListener(ue,e)},q=[r,f],t[40]=r,t[41]=f,t[42]=K,t[43]=q):(K=t[42],q=t[43]),(0,Z.useEffect)(K,q);let J,Y;t[44]!==r||t[45]!==f||t[46]!==c?(J=()=>{if(!f)return;let e=h.current;if(!e)return;let t=de(r);if(!t)return;if(t.kind!==`selection-offset`){fe(r),t.kind===`outline`?ot(e,t.detail,r):t.kind===`lint`?ct(e,t.detail,r):t.kind===`raw-mdx`&&st(e,t.detail,()=>b.current,r);return}let n=!1,i=null;return queueMicrotask(()=>{if(n)return;let t=de(r);t?.kind===`selection-offset`&&(i=le({view:e,docName:r,navigation:t,ydoc:c.document,transition:{from:`wysiwyg`,to:`source`}}),i&&fe(r))}),()=>{n=!0,i?.cancel(`mode-flip`)}},Y=[r,f,c],t[44]=r,t[45]=f,t[46]=c,t[47]=J,t[48]=Y):(J=t[47],Y=t[48]),(0,Z.useEffect)(J,Y);let X;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,rt.jsx)(`div`,{ref:p,className:`source-editor h-full pb-3`}),t[49]=X):X=t[49],X}function ut(){return{top:it}}function dt(){return g()}export{lt as SourceEditor,st as applyRawMdxNavigation};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-RQ5o7P7w.js";import{Nt as c,Xr as l,Yr as u,en as d,in as f}from"./dist-DIn3VYDc2.js";import{t as p}from"./x-xV4a4mi6.js";import{n as m}from"./dist-uN7pEWl0.js";import{f as h,p as g,u as _}from"./doc-paths-KCjzuC60.js";import{X as v}from"./navigation-targets-BDSeZX3c.js";import{t as y}from"./config-context-CdjtvoAz.js";import{f as b,h as x}from"./file-tree-adapter-BBMHbQG5.js";import{t as ee}from"./use-live-xterm-theme-Bf72FxVk.js";var S=a(),C=2,w=1,te=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(C,Math.floor(u/e.css.cell.width)),rows:Math.max(w,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]],ne=[[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 re(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 ie=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]:re(e,ne)?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=$e.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return $e.createPropertyValue(0,n,r)}},ae=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?se.isErrorNoTelemetry(e)?new se(e.message+`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-RQ5o7P7w.js";import{Nt as c,Xr as l,Yr as u,en as d,in as f}from"./dist-5ovMzVKN2.js";import{t as p}from"./x-xV4a4mi6.js";import{n as m}from"./dist-uN7pEWl0.js";import{f as h,p as g,u as _}from"./doc-paths-BFNbv2er.js";import{X as v}from"./navigation-targets-D9VW9WdW.js";import{t as y}from"./config-context-B2fceTMP.js";import{f as b,h as x}from"./file-tree-adapter-C1zJK1Gk.js";import{t as ee}from"./use-live-xterm-theme-CLCjRdjJ.js";var S=a(),C=2,w=1,te=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(C,Math.floor(u/e.css.cell.width)),rows:Math.max(w,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]],ne=[[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 re(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 ie=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]:re(e,ne)?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=$e.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return $e.createPropertyValue(0,n,r)}},ae=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?se.isErrorNoTelemetry(e)?new se(e.message+`
2
2
 
3
3
  `+e.stack):Error(e.message+`
4
4