@inkeep/open-knowledge 0.65.0-beta.1 → 0.65.0-beta.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 (136) hide show
  1. package/dist/{acp-harness-probe-6O1iSYIR.mjs → acp-harness-probe-DQQnlizp.mjs} +2 -2
  2. package/dist/assets/skills/packs/okf/SKILL.md +2 -1
  3. package/dist/cli.mjs +6 -6
  4. package/dist/constants-WlQ6Ul94.mjs +2 -0
  5. package/dist/git-handle-CUMkcH0Q.mjs +1 -0
  6. package/dist/{git-handle-tXqNDNbG.mjs → git-handle-CeLf_80_.mjs} +2 -2
  7. package/dist/index.mjs +149 -149
  8. package/dist/{init-BJVLqPEk.mjs → init-BSohnsOd.mjs} +3 -3
  9. package/dist/init-DjRxGcOV.mjs +1 -0
  10. package/dist/{launch-json-removal-C7vezYJn.mjs → launch-json-removal-cA-XEwIM.mjs} +2 -2
  11. package/dist/{loader-C4nhWSIa.mjs → loader-BSWlIhHW.mjs} +2 -2
  12. package/dist/loader-DOqrWZZ1.mjs +1 -0
  13. package/dist/md-manager-DrTOG_TR.mjs +2 -0
  14. package/dist/{open-browser-CxqP3TDJ.mjs → open-browser-DScjpc4A.mjs} +2 -2
  15. package/dist/parse-worker.mjs +1 -1
  16. package/dist/{preview-BZwSz2kH.mjs → preview-BSBsz04I.mjs} +2 -2
  17. package/dist/preview-BU6qghZM.mjs +1 -0
  18. package/dist/public/assets/ActivityModeContent-iVCQqweq.js +1 -0
  19. package/dist/public/assets/{AddPropertiesButton-BUwqaT5p.js → AddPropertiesButton-CPf02Fwa.js} +1 -1
  20. package/dist/public/assets/{AgentDiffPane-BUtJ3PVG.js → AgentDiffPane-BtpGOC45.js} +1 -1
  21. package/dist/public/assets/{AgentThreadClientBinder-1lFfm0IN.js → AgentThreadClientBinder-byV-mbnY.js} +1 -1
  22. package/dist/public/assets/{BugReportHistory-jSGSgPau.js → BugReportHistory-Mvnt4SEp.js} +1 -1
  23. package/dist/public/assets/{BugReportHistoryDialog-fz9oCk7_.js → BugReportHistoryDialog-DcWVOW9N.js} +1 -1
  24. package/dist/public/assets/{CodeMirrorPropInput-UX9dc3lK.js → CodeMirrorPropInput-B6CoPdiS.js} +1 -1
  25. package/dist/public/assets/{ConsentDialogBody-owDDRjs1.js → ConsentDialogBody-0hoJ_ijU.js} +1 -1
  26. package/dist/public/assets/{DocumentContext-rwQWKRwZ.js → DocumentContext-cm1ZiCIR.js} +2 -2
  27. package/dist/public/assets/{EditorModeToggle-Ca5ZwX6h.js → EditorModeToggle-CgD37GNE.js} +1 -1
  28. package/dist/public/assets/{EnableSyncConfirmDialog-DzdCcHho.js → EnableSyncConfirmDialog-DFj2_7qp.js} +1 -1
  29. package/dist/public/assets/{ExcalidrawDocEditor-SaZwdFgG.js → ExcalidrawDocEditor-Du-VDkG1.js} +1 -1
  30. package/dist/public/assets/FeedbackForm-DUIxFfzS.js +1 -0
  31. package/dist/public/assets/{GraphPanel-B_ODpcQR.js → GraphPanel-BV1qD1M6.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-Bx_ZWuER.js → ImportSkillDialog-D3CIOCxg.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-BSHD88gy.js → LintConfigEditor-BgNu1pk8.js} +1 -1
  34. package/dist/public/assets/{ManagedArtifactProperties-BgdX1sgG.js → ManagedArtifactProperties-B8EqUoZ3.js} +1 -1
  35. package/dist/public/assets/ManagedArtifactProperties-BPguuakJ.js +1 -0
  36. package/dist/public/assets/{MermaidDocEditor-B4OuFFRH.js → MermaidDocEditor-DX11737F.js} +1 -1
  37. package/dist/public/assets/PropertyDisplayRow-DFgojvKc.js +2 -0
  38. package/dist/public/assets/{ReportBugDialogBody-U3FbBtM2.js → ReportBugDialogBody-rfqM32yk.js} +1 -1
  39. package/dist/public/assets/{ReportBugMenuTrigger-CGkkALKR.js → ReportBugMenuTrigger-MbnqF2SK.js} +2 -2
  40. package/dist/public/assets/{SchemaConfigEditor-CFOJQbAI.js → SchemaConfigEditor-D2sSopqD.js} +1 -1
  41. package/dist/public/assets/{SessionsHost-Df2f1sfx.js → SessionsHost-CL1ekzh8.js} +2 -2
  42. package/dist/public/assets/{SettingsDialogBody-D4mpzMAr.js → SettingsDialogBody-CcLAF7VK.js} +1 -1
  43. package/dist/public/assets/{ShareBranchSwitchDialog-B_ybMKWR.js → ShareBranchSwitchDialog-BO0uIFs7.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveDialog-D8IcYMqn.js → ShareReceiveDialog-CskBIDXp.js} +1 -1
  45. package/dist/public/assets/{ShareReceiveMissDialog-eZXVNMEa.js → ShareReceiveMissDialog-DbZQyqUj.js} +1 -1
  46. package/dist/public/assets/{SkillCostValue-CtuMRUcB.js → SkillCostValue-CNJ4MgeB.js} +1 -1
  47. package/dist/public/assets/{SkillEditBanner-CgahuR4V.js → SkillEditBanner-DACxakQd.js} +1 -1
  48. package/dist/public/assets/{SkillInstallMenu-t_UwNdxn.js → SkillInstallMenu-DsV7Zg_N.js} +1 -1
  49. package/dist/public/assets/{SkillOriginInline-caW0di8-.js → SkillOriginInline-Dy2zQZrT.js} +1 -1
  50. package/dist/public/assets/{SkillToolbarControls-BQSRblTW.js → SkillToolbarControls-CK1hDwSR.js} +1 -1
  51. package/dist/public/assets/{SlidesToolbarControls-DmkIlVkT.js → SlidesToolbarControls-DauhKnHa.js} +1 -1
  52. package/dist/public/assets/{SourceEditor-DSD8q5gQ.js → SourceEditor-BAFCEDOW.js} +1 -1
  53. package/dist/public/assets/{TerminalPanel-3sFIDMyj.js → TerminalPanel-BCS-RzlD.js} +1 -1
  54. package/dist/public/assets/{TerminalWindowApp-kA8FxYDa.js → TerminalWindowApp-Pr86JmqX.js} +1 -1
  55. package/dist/public/assets/{TextDocEditor-31V7aZDr.js → TextDocEditor-CuXA3fG7.js} +1 -1
  56. package/dist/public/assets/{ThreadView-BXcveKKj.js → ThreadView-D7sS5GXu.js} +9 -9
  57. package/dist/public/assets/{TimelineDiffPane-ZXlxZPTz.js → TimelineDiffPane-C4-v6VKa.js} +1 -1
  58. package/dist/public/assets/{agent-diff-store-Cpo8SCiH.js → agent-diff-store-BD87nz3F.js} +1 -1
  59. package/dist/public/assets/{auth-state-cache-sqbJYZts.js → auth-state-cache-BmBuSpVr.js} +1 -1
  60. package/dist/public/assets/{bug-report-send-manager--d3jxz25.js → bug-report-send-manager-CWBwJLhw.js} +1 -1
  61. package/dist/public/assets/{client-version-CXjYjiUZ.js → client-version-D2q-P0iF.js} +1 -1
  62. package/dist/public/assets/{comment-chips-DAhAsZ8A.js → comment-chips-DsXikPkv.js} +1 -1
  63. package/dist/public/assets/{config-provider-D8nQpnDa.js → config-provider-CTJraL6m.js} +1 -1
  64. package/dist/public/assets/{dist-B5qwv8-p.js → dist-7elyeD1s.js} +195 -195
  65. package/dist/public/assets/doc-paths-D_8UvPYx.js +1 -0
  66. package/dist/public/assets/{documents-events-BS3zz_ja.js → documents-events--JsHluy4.js} +1 -1
  67. package/dist/public/assets/{file-tree-adapter-CxsCZrWb.js → file-tree-adapter-DNXscpMG.js} +1 -1
  68. package/dist/public/assets/{file-tree-utils-BunIXRa7.js → file-tree-utils-BjUMUlWv.js} +1 -1
  69. package/dist/public/assets/{folder-config-api-BZVpNPGc.js → folder-config-api-D4_ApcVY.js} +1 -1
  70. package/dist/public/assets/i18n-BZGgf8Qd.js +1 -0
  71. package/dist/public/assets/{index-D8LrmUIw.js → index-BE2TsSEM.js} +7 -7
  72. package/dist/public/assets/{launcher-selection-BBUas603.js → launcher-selection-DGh5-Pqt.js} +1 -1
  73. package/dist/public/assets/{lint-config-client-BVZllbYJ.js → lint-config-client-RAMPJ8G7.js} +1 -1
  74. package/dist/public/assets/{markdownlint-rule-browser-OBj8w6AO.js → markdownlint-rule-browser-DitAECCM.js} +1 -1
  75. package/dist/public/assets/{page-list-cache-B3bvGAO5.js → page-list-cache-prUKRtRa.js} +1 -1
  76. package/dist/public/assets/{pending-receive-nav-store-Cfa5notj.js → pending-receive-nav-store-DC3PrSPg.js} +1 -1
  77. package/dist/public/assets/{progress-CGKEmqEm.js → progress-BEXaBNIb.js} +1 -1
  78. package/dist/public/assets/{project-paths-C69jkmMe.js → project-paths-D9vcEZSb.js} +1 -1
  79. package/dist/public/assets/{prop-types-B41RJtGt.js → prop-types-BOXmr7Q9.js} +1 -1
  80. package/dist/public/assets/{receive-store-D7nvngvO.js → receive-store-DMcyiDfj.js} +1 -1
  81. package/dist/public/assets/{selection-context-zaeIFGZP.js → selection-context-CLtjNgSV.js} +1 -1
  82. package/dist/public/assets/{skill-scope-BVNk6qeO.js → skill-scope-CVSSymVB.js} +1 -1
  83. package/dist/public/assets/{skills-api-Cq8_IlLq.js → skills-api-DHpABbiE.js} +1 -1
  84. package/dist/public/assets/{src-G5zdelKj.js → src-Dq3nd0Lx.js} +1 -1
  85. package/dist/public/assets/{startup-marks-jv6Qs2uF.js → startup-marks-lmLF_OO-.js} +1 -1
  86. package/dist/public/assets/{tag-pill-input-88p34I7w.js → tag-pill-input-DHmb-7zU.js} +1 -1
  87. package/dist/public/assets/{target-navigation-intent-BxOTP9s7.js → target-navigation-intent-zJ017p9i.js} +1 -1
  88. package/dist/public/assets/{telemetry-startup-CKd1LVjo.js → telemetry-startup-DI_JMeyZ.js} +1 -1
  89. package/dist/public/assets/{terminal-cli-display-DB9HP8Kz.js → terminal-cli-display-2og2-PQg.js} +1 -1
  90. package/dist/public/assets/{typing-burst-detector-D7MT9xAL.js → typing-burst-detector-EBpBvXLS.js} +1 -1
  91. package/dist/public/assets/{uninstall-CqsvXVvr.js → uninstall-Cs7fpSSM.js} +1 -1
  92. package/dist/public/assets/{use-activity-panel-Cwiaxn7-.js → use-activity-panel-BP6cVXAM.js} +1 -1
  93. package/dist/public/assets/{use-apply-config-color-theme-BnIQOGE2.js → use-apply-config-color-theme-DdXME66g.js} +1 -1
  94. package/dist/public/assets/{use-collab-url-BonPNl3w.js → use-collab-url-Bw-ux1e9.js} +1 -1
  95. package/dist/public/assets/{use-live-xterm-theme-BkFdBq13.js → use-live-xterm-theme-cynTCBxO.js} +1 -1
  96. package/dist/public/assets/{use-open-skill-B5CQCTU9.js → use-open-skill-C2S8Ju9E.js} +1 -1
  97. package/dist/public/assets/{use-settings-route-K9deeZD-.js → use-settings-route-DHPJ3RaJ.js} +1 -1
  98. package/dist/public/assets/{use-skill-origin-BFlhRLbw.js → use-skill-origin-CH9FS4YO.js} +1 -1
  99. package/dist/public/assets/{use-skills-DFfNPUrm.js → use-skills-D56xe4F0.js} +1 -1
  100. package/dist/public/assets/{use-terminal-enabled-Dn6oVKSs.js → use-terminal-enabled-DTa27VwS.js} +1 -1
  101. package/dist/public/assets/{use-timeline-entry-diff-Dy-DyEiC.js → use-timeline-entry-diff-7MYmjURO.js} +1 -1
  102. package/dist/public/assets/{use-workspace-BA9aicCx.js → use-workspace-BiK7U2Dp.js} +1 -1
  103. package/dist/public/index.html +47 -47
  104. package/dist/public/uninstall.html +3 -3
  105. package/dist/{repair-launch-json-DUTqYxFF.mjs → repair-launch-json-CNEyG1iy.mjs} +2 -2
  106. package/dist/{repair-mcp-configs-xEpY6E7V.mjs → repair-mcp-configs-B0AIoQsw.mjs} +2 -2
  107. package/dist/repair-skills-BArwmDoi.mjs +1 -0
  108. package/dist/{repair-skills-CnlSJ7Cv.mjs → repair-skills-DkqRt0jh.mjs} +2 -2
  109. package/dist/{resolve-project-root-H2LH3evF.mjs → resolve-project-root-DZ8FUmWA.mjs} +2 -2
  110. package/dist/server-lock-Bdq8J23F.mjs +1 -0
  111. package/dist/{server-lock-pONFRxy9.mjs → server-lock-DE-aYwut.mjs} +2 -2
  112. package/dist/{skill-teardown-h8wjTE5-.mjs → skill-teardown-n1roKgm3.mjs} +2 -2
  113. package/dist/{src-ywNiPY0Z.mjs → src-BIzvFai3.mjs} +2 -2
  114. package/dist/{src-wzwdHnH1.mjs → src-Ct2lVbOu.mjs} +117 -117
  115. package/dist/{src-8rHUz2eY.mjs → src-DHmPa1LN.mjs} +1 -1
  116. package/dist/{src-1Rp1Dq8a.mjs → src-DeoDqJay.mjs} +4 -4
  117. package/dist/src-PgKZrUu6.mjs +1 -0
  118. package/dist/{start-DKaGdrt1.mjs → start-D8mbQnet.mjs} +3 -3
  119. package/dist/start-tsYshIKA.mjs +1 -0
  120. package/package.json +4 -4
  121. package/dist/constants-YeHiomno.mjs +0 -2
  122. package/dist/git-handle-CqlG0S4W.mjs +0 -1
  123. package/dist/init-yJjl6861.mjs +0 -1
  124. package/dist/loader-BGxw7stI.mjs +0 -1
  125. package/dist/md-manager-Bu71zQPt.mjs +0 -2
  126. package/dist/preview-SYaXc23U.mjs +0 -1
  127. package/dist/public/assets/ActivityModeContent-DotCr2H_.js +0 -1
  128. package/dist/public/assets/FeedbackForm-DJqGpa9l.js +0 -1
  129. package/dist/public/assets/ManagedArtifactProperties-B0O5eYlt.js +0 -1
  130. package/dist/public/assets/PropertyDisplayRow-Bl0tZ1a5.js +0 -2
  131. package/dist/public/assets/doc-paths-mRmnn5mL.js +0 -1
  132. package/dist/public/assets/i18n-BwxzDzCF.js +0 -1
  133. package/dist/repair-skills-Ddx30mOx.mjs +0 -1
  134. package/dist/server-lock-JctV7pHU.mjs +0 -1
  135. package/dist/src-xpcCGBI8.mjs +0 -1
  136. package/dist/start-ZBZQC08F.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{B as r,Q as i,V as a,et as o,ir as s,it as c,k as l,nt as u,or as d,pi as f,rt as p,yr as m}from"./DocumentContext-rwQWKRwZ.js";import{t as h}from"./react-f2sANaYj.js";import{n as g,r as _}from"./dist-Nvb76hAm.js";import{t as v}from"./useQuery-ZeEDLtxh.js";import{n as y}from"./dist-PQ5KMVDh.js";import{t as b}from"./compiler-runtime-BfE3aGVn.js";import{i as x}from"./local-menu-action-bus-BLEUyEvu.js";import{t as S}from"./utils-CPqDy6Hr.js";import{_ as C,b as w,g as T,h as E,m as D,p as O,y as k}from"./SkillInstallMenu-t_UwNdxn.js";import{t as A}from"./button-Cym3gapE.js";import{i as j,n as M,r as N,t as P}from"./tooltip-DttaCTqz.js";import{n as F,r as I,t as L}from"./collapsible-DYySK8La.js";import{a as R,c as z,i as B,n as V,o as H,r as U,s as W,t as ee}from"./dialog-CTNat3T_.js";import{a as G,c as te,i as K,l as q,n as J,o as ne,r as re,s as ie,t as ae}from"./alert-dialog-D9BtoYXB.js";import{Tt as oe}from"./CodeMirrorPropInput-UX9dc3lK.js";import{t as se}from"./checkbox-LVDa5cS9.js";import{n as ce,r as le}from"./terminal-cli-display-DB9HP8Kz.js";import{a as ue,m as Y,r as de,t as fe}from"./dropdown-menu-CRvS0_4-.js";import{t as pe}from"./label-D-K3fWtj.js";import{i as me,n as he,o as ge,s as _e,t as ve}from"./select-XEGYznMI.js";import{n as ye,t as be}from"./radio-group-npdxiS6E.js";import{n as xe}from"./separator-C6x7j8mC.js";import{t as Se}from"./switch-iwBsEWej.js";import{n as Ce,r as we,t as Te}from"./toggle-group-C2_37kV5.js";import{_ as Ee,a as De,b as Oe,c as ke,d as Ae,g as je,i as Me,l as Ne,o as Pe,p as Fe,s as Ie,t as Le,u as Re}from"./RegisteredAgentIcon-CDl1h-4U.js";import{a as ze,i as Be,o as Ve}from"./terminal-telemetry-DI0bolzP.js";import{$s as He,$t as Ue,As as We,Bn as Ge,Cs as Ke,Fs as qe,Gs as Je,Hs as Ye,Is as Xe,Kr as Ze,Ls as Qe,Ms as $e,Rs as et,Ts as tt,Us as nt,Vs as rt,Ws as it,Xr as at,Xs as ot,Yi as st,Yo as ct,_n as lt,as as ut,bo as dt,bs as ft,ct as pt,en as mt,fo as ht,gn as gt,go as _t,gs as vt,hs as yt,ls as bt,ms as xt,ns as St,nt as Ct,os as wt,ps as Tt,qs as Et,rs as Dt,st as Ot,ts as kt,uo as At,ws as jt,wt as Mt,xr as Nt,xs as Pt,ys as Ft}from"./dist-B5qwv8-p.js";import{t as It}from"./trace-api-BP9dN1Hz.js";import{n as X}from"./dist-CJhtNlOm2.js";import{d as Lt,f as Rt,h as zt,n as Bt,o as Vt,p as Ht,r as Ut,u as Wt,v as Gt}from"./use-settings-route-K9deeZD-.js";import{t as Kt}from"./dist-Cr4-nBVI.js";import{c as qt}from"./documents-events-BS3zz_ja.js";import{a as Jt,i as Yt,t as Xt}from"./use-apply-config-theme-CBmHKD_B.js";import{t as Zt}from"./createLucideIcon-BulbvLvN.js";import{a as Qt,c as $t,f as en,g as tn,l as nn,m as rn,p as an,s as on,t as sn}from"./EnableSyncConfirmDialog-DzdCcHho.js";import{l as cn}from"./Mermaid-B4Oa2diB.js";import{t as ln}from"./arrow-up-right-BTi7mHwL.js";import{t as un}from"./check-Dut4Aov8.js";import{t as dn}from"./chevron-right-4mYNnAZZ.js";import{n as fn,t as pn}from"./lint-plugin-meta-LEBWvINg.js";import{t as mn}from"./circle-alert-b-E0_BIP.js";import{i as hn,r as gn}from"./prop-types-B41RJtGt.js";import{$ as _n,A as vn,B as yn,C as bn,D as xn,G as Sn,H as Cn,J as wn,K as Tn,L as En,M as Dn,N as On,O as kn,P as An,R as jn,S as Mn,U as Nn,V as Pn,W as Fn,Z as In,_ as Ln,b as Rn,c as zn,d as Bn,f as Vn,g as Hn,i as Un,j as Wn,k as Gn,l as Kn,m as qn,n as Jn,nt as Yn,o as Xn,p as Zn,q as Qn,tt as $n,v as er,x as tr,y as nr}from"./auth-state-cache-sqbJYZts.js";import{t as rr}from"./terminal-D4HSnHXf.js";import{o as ir,s as ar,t as or}from"./use-open-skill-B5CQCTU9.js";import{o as sr}from"./folder-config-api-BZVpNPGc.js";import{t as cr}from"./info-SlzbpjOb.js";import{t as lr}from"./spinner-t7GahFcQ.js";import{n as ur,r as dr,t as fr}from"./ThemePicker-DH1tY5im.js";import{t as pr}from"./square-pen-CBGVrQUa.js";import{t as mr}from"./trash-2-DSqYvaPJ.js";import{t as hr}from"./triangle-alert-GeclLtDN.js";import{t as gr}from"./x-DbShSCr5.js";import{d as _r}from"./doc-paths-mRmnn5mL.js";import{a as vr}from"./startup-marks-jv6Qs2uF.js";import{a as yr,n as br}from"./config-provider-D8nQpnDa.js";import{m as xr}from"./skills-api-Cq8_IlLq.js";import{a as Sr}from"./skill-scope-BVNk6qeO.js";import{t as Cr}from"./input-DJ1c1x-M.js";import{a as wr,i as Tr,t as Er}from"./popover-BE6X9rKr.js";import{a as Dr,c as Or,d as kr,f as Ar,i as jr,l as Mr,n as Nr,o as Pr,p as Fr,s as Ir,u as Lr}from"./use-apply-config-color-theme-BnIQOGE2.js";import{t as Rr}from"./external-link-B0bVg1hn.js";import{t as zr}from"./badge-BWfmbBoh.js";import{t as Br}from"./tool-list-format-DRi3JW8x.js";import{i as Vr,o as Hr,r as Ur,t as Wr}from"./field-Di3yPBdO.js";import{t as Gr}from"./ConfigSharingInfoTooltip-BzRIZ5Ed.js";import{t as Kr}from"./use-skills-DFfNPUrm.js";import{t as qr}from"./skeleton-BZIHOzZH.js";import{d as Jr,n as Yr,r as Xr,t as Zr,u as Qr}from"./lint-config-client-BVZllbYJ.js";import{_ as $r,a as ei,d as ti,f as ni,g as ri,h as ii,i as ai,o as oi,s as si,t as ci,u as li}from"./sortable.esm-DK-jMveF.js";import{t as ui}from"./textarea-BoMa_3jF.js";import{n as di,r as fi,t as pi}from"./input-group-eVl8FXAc.js";import{a as mi,f as hi,i as gi,n as _i,o as vi,p as yi,r as bi,s as xi,t as Si}from"./form-Bz-LEGU-.js";import{r as Ci,t as wi}from"./terminal-command-events-D0gJ8NJs.js";import{t as Ti}from"./tag-pill-input-88p34I7w.js";import{t as Ei}from"./markdownlint-rule-browser-OBj8w6AO.js";import{n as Di}from"./schema-fields-view-intent-DCUTojNw.js";import{n as Oi,t as ki}from"./use-terminal-enabled-Dn6oVKSs.js";var Ai=Zt(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ji=Zt(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Mi=Zt(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),Ni=Zt(`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=e(h(),1),Q=b(),$=n();function Pi(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(zr,{variant:`gray`,children:(0,$.jsx)(g,{id:`YBt9YP`})}),e[0]=t):t=e[0],t}function Fi(e){let t=(0,Q.c)(10),{scope:n}=e,r=`settings-scope-badge-${n}`,i;t[0]===n?i=t[1]:(i=n===`user`?(0,$.jsx)(g,{id:`7PzzBU`}):n===`project-local`?(0,$.jsx)(g,{id:`ImTzPZ`}):(0,$.jsx)(g,{id:`e0NrBM`}),t[0]=n,t[1]=i);let a;t[2]!==r||t[3]!==i?(a=(0,$.jsx)(j,{asChild:!0,children:(0,$.jsx)(zr,{variant:`gray`,tabIndex:0,className:`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"data-testid":r,children:i})}),t[2]=r,t[3]=i,t[4]=a):a=t[4];let o;t[5]===n?o=t[6]:(o=(0,$.jsx)(M,{children:n===`user`?(0,$.jsx)(g,{id:`cFSbbh`}):n===`project-local`?(0,$.jsx)(g,{id:`YlwI5F`}):(0,$.jsx)(g,{id:`ebqMh6`})}),t[5]=n,t[6]=o);let s;return t[7]!==a||t[8]!==o?(s=(0,$.jsx)(N,{children:(0,$.jsxs)(P,{children:[a,o]})}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Ii(e){let t=(0,Q.c)(27),{titleId:n,title:r,scope:i,level:a,beta:o,adornment:s,docUrl:c,children:l}=e,u=a===void 0?`page`:a,{_:d}=_(),f=u===`page`?`h3`:`h4`,p=u===`page`?`text-lg`:`text-base`,m;t[0]===p?m=t[1]:(m=S(`font-semibold`,p),t[0]=p,t[1]=m);let h;t[2]!==f||t[3]!==m||t[4]!==r||t[5]!==n?(h=(0,$.jsx)(f,{id:n,className:m,children:r}),t[2]=f,t[3]=m,t[4]=r,t[5]=n,t[6]=h):h=t[6];let v;t[7]===o?v=t[8]:(v=o?(0,$.jsx)(Pi,{}):null,t[7]=o,t[8]=v);let y;t[9]===i?y=t[10]:(y=i?(0,$.jsx)(Fi,{scope:i}):null,t[9]=i,t[10]=y);let b;t[11]!==s||t[12]!==h||t[13]!==v||t[14]!==y?(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,s,v,y]}),t[11]=s,t[12]=h,t[13]=v,t[14]=y,t[15]=b):b=t[15];let x;t[16]===l?x=t[17]:(x=l?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l}):null,t[16]=l,t[17]=x);let C;t[18]!==d||t[19]!==c||t[20]!==r||t[21]!==n?(C=c===void 0?null:(0,$.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Rr(e,c),onAuxClick:e=>Rr(e,c),"aria-label":d(typeof r==`string`?{id:`Li4U-T`,values:{title:r}}:{id:`zwWKhA`}),className:`inline-flex items-center gap-0.5 text-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`${n}-docs-link`,children:[(0,$.jsx)(g,{id:`zwWKhA`}),(0,$.jsx)(ln,{"aria-hidden":!0,className:`size-3`})]}),t[18]=d,t[19]=c,t[20]=r,t[21]=n,t[22]=C):C=t[22];let w;return t[23]!==b||t[24]!==x||t[25]!==C?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[b,x,C]}),t[23]=b,t[24]=x,t[25]=C,t[26]=w):w=t[26],w}var Li=`settings-sharing-title`;function Ri(){let e=(0,Q.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)(zi,{}):(0,$.jsx)(Bi,{}),e[0]=n):n=e[0],n}function zi(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(g,{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":Li,className:`space-y-3`,"data-field":`section:sharing`,children:(0,$.jsx)(Ii,{titleId:Li,title:t,scope:`project`,level:`block`,children:(0,$.jsx)(g,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})}),e[1]=n):n=e[1],n}function Bi(){let e=(0,Q.c)(29),{_:t}=_(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c;e[0]===t?c=e[1]:(c=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(Hi)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Z.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({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 l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ii,{titleId:Li,title:(0,$.jsx)(g,{id:`cs4mps`}),scope:`project`,level:`block`}),e[10]=t):t=e[10];let n;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`section`,{"aria-labelledby":Li,className:`space-y-3`,"data-field":`section:sharing`,children:[t,(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(g,{id:`eQn7nI`})}),(0,$.jsx)(qr,{className:`h-24`})]})]}),e[11]=n):n=e[11],n}let m=n.mode===`no-git`,h;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(g,{id:`cs4mps`}),e[12]=h):h=e[12];let v;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(Ii,{titleId:Li,title:h,scope:`project`,level:`block`,adornment:(0,$.jsx)(Gr,{}),children:(0,$.jsx)(g,{id:`N55YNr`})}),e[13]=v):v=e[13];let y;e[14]!==i||e[15]!==m||e[16]!==p||e[17]!==n.mode?(y=m?(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)(g,{id:`ju38ms`})}):(0,$.jsxs)(be,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Li,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(ye,{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)(g,{id:`QjzFZj`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(g,{id:`un-K1H`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(ye,{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)(g,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(g,{id:`dJw2_7`})})]})]})]}),e[14]=i,e[15]=m,e[16]=p,e[17]=n.mode,e[18]=y):y=e[18];let b;e[19]===o?b=e[20]:(b=o===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)(g,{id:`ZscwQ0`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(g,{id:`1QfxQT`})})]}),e[19]=o,e[20]=b);let x;e[21]!==o||e[22]!==n.mode||e[23]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===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)(g,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(Vi)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(g,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[21]=o,e[22]=n.mode,e[23]=n.trackedUpstream,e[24]=x):x=e[24];let S;return e[25]!==y||e[26]!==b||e[27]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":Li,className:`space-y-4`,"data-testid":`settings-sharing`,"data-field":`section:sharing`,children:[v,y,b,x]}),e[25]=y,e[26]=b,e[27]=x,e[28]=S):S=e[28],S}function Vi(e){return(0,$.jsx)(`li`,{children:e},e)}function Hi(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}function Ui(e){let t=(0,Q.c)(35),{authQueryTransport:n,authTransport:r}=e,{_:i}=_(),a;t[0]===n?a=t[1]:(a=n??In(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Z.useState)(s),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),v=(0,Z.useRef)(!1),y;t[3]===o?y=t[4]:(y=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),Jn(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=y);let b=y,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[7]=S):S=t[7],(0,Z.useEffect)(x,S);let C;t[8]!==i||t[9]!==b||t[10]!==o?(C=async function(){if(v.current)return;v.current=!0,d(!1),p(!0),h(null);let e=null;try{let t=o.signout?await o.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&&h(e),p(!1),v.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=C):C=t[11];let w=C,T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(g,{id:`AeXO77`}),t[12]=T):T=t[12];let E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Ii,{titleId:`settings-account-title`,title:T,scope:`user`,children:(0,$.jsx)(g,{id:`E6lrpp`})}),t[13]=E):E=t[13];let D;t[14]!==m||t[15]!==f||t[16]!==w||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(D=c.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)(g,{id:`IWGfGF`})}),(0,$.jsx)(qr,{className:`h-4 w-40`}),(0,$.jsx)(qr,{className:`h-8 w-32`})]}):c.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)(g,{id:`T_wG4n`})}),(0,$.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(g,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(Gi,{login:c.result.login}):(0,$.jsx)(Wi,{login:c.result.login,disconnecting:f,error:m,onDisconnect:()=>void w()}):(0,$.jsx)(Ki,{onConnect:()=>d(!0)}),t[14]=m,t[15]=f,t[16]=w,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=D):D=t[20];let O;t[21]===b?O=t[22]:(O=e=>{d(e),e||b()},t[21]=b,t[22]=O);let k=c.phase===`loaded`?c.result.host:void 0,j=c.phase===`loaded`?c.result.ghAvailable:void 0,M;t[23]===b?M=t[24]:(M=()=>{b()},t[23]=b,t[24]=M);let N;t[25]!==u||t[26]!==r||t[27]!==O||t[28]!==k||t[29]!==j||t[30]!==M?(N=(0,$.jsx)(wn,{open:u,onOpenChange:O,transport:r,host:k,ghAvailable:j,onSuccess:M}),t[25]=u,t[26]=r,t[27]=O,t[28]=k,t[29]=j,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==N||t[33]!==D?(P=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[E,D,N]}),t[32]=N,t[33]=D,t[34]=P):P=t[34],P}function Wi(e){let t=(0,Q.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(g,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(g,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(g,{id:`rppgXF`}):(0,$.jsx)(g,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(A,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(g,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=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]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function Gi(e){let t=(0,Q.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(g,{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)(g,{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 Ki(e){let t=(0,Q.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)(g,{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)(g,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(g,{id:`5lWFkC`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(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)(A,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function qi(e,t){let n=e=>e.state!==`not-installed`||e.detected,r=e.filter(n),i=r.length>0&&r.length<e.length;return{shownEditors:!i||t?[...e].sort((e,t)=>Number(n(t))-Number(n(e))):r,hiddenCount:i?e.length-r.length:0}}function Ji(e){let t=(0,Q.c)(9),{hiddenCount:n,expanded:r,onToggle:i,testId:a}=e,{_:o}=_();if(n===0)return null;let s;t[0]!==o||t[1]!==r||t[2]!==n?(s=o(r?{id:`6lGV3K`}:{id:`INN7OX`,values:{hiddenCount:n}}),t[0]=o,t[1]=r,t[2]=n,t[3]=s):s=t[3];let c;return t[4]!==r||t[5]!==i||t[6]!==s||t[7]!==a?(c=(0,$.jsx)(`li`,{children:(0,$.jsx)(A,{type:`button`,variant:`ghost`,"aria-expanded":r,onClick:i,className:`w-full justify-center rounded-none font-normal text-muted-foreground text-xs`,"data-testid":a,children:s})}),t[4]=r,t[5]=i,t[6]=s,t[7]=a,t[8]=c):c=t[8],c}function Yi(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function Xi(e){let t=(0,Q.c)(11),{testId:n,children:r}=e,{_:i}=_(),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)(cr,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(j,{asChild:!0,children:(0,$.jsx)(A,{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]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=(0,$.jsx)(M,{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]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(P,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Zi(){let e=(0,Q.c)(61),{_:t}=_(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(!1),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||o(!0)}),()=>{e=!0}},f=[n],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Z.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=async function(e,r){if(n){c(Yi(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)}}))}c(null)}},e[2]=t,e[3]=p);let m=p,h,v,y,b,x,S,C,w,T,E,D;if(e[4]!==t||e[5]!==m||e[6]!==a||e[7]!==s||e[8]!==l||e[9]!==r){b=Symbol.for(`react.early_return_sentinel`);bb0:{let i;e[21]===r?.editors?i=e[22]:(i=r?.editors??[],e[21]=r?.editors,e[22]=i);let{shownEditors:o,hiddenCount:c}=qi(i,l);h=c;let u;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(g,{id:`_5qBNl`}),e[23]=u):u=e[23];let d;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(Ii,{titleId:`settings-ai-tools-title`,title:u,scope:`user`,children:(0,$.jsx)(g,{id:`mLAjyL`})}),e[24]=d):d=e[24];let f=d;if(!n||a){let t;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[f,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(g,{id:`O4PnDd`})})]}),e[25]=t):t=e[25],b=t;break bb0}if(r===null){let t;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[f,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(qr,{className:`h-10 w-full`}),(0,$.jsx)(qr,{className:`h-10 w-full`}),(0,$.jsx)(qr,{className:`h-10 w-full`})]})]}),e[26]=t):t=e[26],b=t;break bb0}let p=s!==null||!r.available,_=r.path.shellDetected||r.path.installed;T=`settings-ai-tools-title`,E=`space-y-4`,D=f,e[27]===r.available?v=e[28]:(v=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`ai-tools-read-only`,children:(0,$.jsx)(g,{id:`OplnBG`})}),e[27]=r.available,e[28]=v),e[29]!==t||e[30]!==m||e[31]!==p||e[32]!==_||e[33]!==r.path.installed||e[34]!==r.path.rcFilesToTouch?(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)(g,{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)(pe,{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)(se,{id:`ai-tools-path`,checked:r.path.installed,disabled:p,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)(g,{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?n.config.ptyAvailable===!0?t({id:`yhdqox`}):t({id:`XEfNPL`}):t({id:`04XyCH`,values:{0:r.path.rcFilesToTouch.join(`, `)}})})]})]}),(0,$.jsxs)(Xi,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(g,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map($i),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(g,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[29]=t,e[30]=m,e[31]=p,e[32]=_,e[33]=r.path.installed,e[34]=r.path.rcFilesToTouch,e[35]=y):y=e[35],C=`flex flex-col gap-1.5`,e[36]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(g,{id:`psfGPX`})}),e[36]=w):w=e[36],x=`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`;let O;e[37]!==t||e[38]!==m||e[39]!==p?(O=e=>{let n=e.state===`installed`||e.state===`foreign`,r=p||e.state===`unmanageable`,i=e.state===`not-installed`,a=`https://openknowledge.ai/docs/integrations/${_t[e.id]}`,o=e.state===`installed`?t({id:`eQkgKV`}):e.state===`foreign`?t({id:`AczYxH`}):e.state===`unmanageable`?t({id:`LbmLyU`}):null,s=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)(pe,{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)(se,{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}),o!==null&&(0,$.jsx)(`span`,{className:s,"data-testid":`ai-tools-editor-status-${e.id}`,children:o})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Rr(e,a),onAuxClick:e=>Rr(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)(g,{id:`P_bX4O`}),(0,$.jsx)(ln,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(Xi,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(g,{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)(g,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[37]=t,e[38]=m,e[39]=p,e[40]=O):O=e[40],S=o.map(O)}e[4]=t,e[5]=m,e[6]=a,e[7]=s,e[8]=l,e[9]=r,e[10]=h,e[11]=v,e[12]=y,e[13]=b,e[14]=x,e[15]=S,e[16]=C,e[17]=w,e[18]=T,e[19]=E,e[20]=D}else h=e[10],v=e[11],y=e[12],b=e[13],x=e[14],S=e[15],C=e[16],w=e[17],T=e[18],E=e[19],D=e[20];if(b!==Symbol.for(`react.early_return_sentinel`))return b;let O;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>u(Qi),e[41]=O):O=e[41];let k;e[42]!==h||e[43]!==l?(k=(0,$.jsx)(Ji,{hiddenCount:h,expanded:l,onToggle:O,testId:`ai-tools-editors-show-more`}),e[42]=h,e[43]=l,e[44]=k):k=e[44];let A;e[45]!==k||e[46]!==x||e[47]!==S?(A=(0,$.jsxs)(`ul`,{className:x,children:[S,k]}),e[45]=k,e[46]=x,e[47]=S,e[48]=A):A=e[48];let j;e[49]!==A||e[50]!==C||e[51]!==w?(j=(0,$.jsxs)(`div`,{className:C,children:[w,A]}),e[49]=A,e[50]=C,e[51]=w,e[52]=j):j=e[52];let M;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-skills-moved`,children:(0,$.jsx)(g,{id:`iKS6gg`})}),e[53]=M):M=e[53];let N;return e[54]!==v||e[55]!==y||e[56]!==j||e[57]!==T||e[58]!==E||e[59]!==D?(N=(0,$.jsxs)(`section`,{"aria-labelledby":T,className:E,children:[D,v,y,j,M]}),e[54]=v,e[55]=y,e[56]=j,e[57]=T,e[58]=E,e[59]=D,e[60]=N):N=e[60],N}function Qi(e){return!e}function $i(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}var ea=`open-knowledge-app`;function ta({from:e,to:t}){try{It.getTracer(ea).startSpan(`ok.language.preferenceChanged`,{attributes:{"ok.language.from":e,"ok.language.to":t}}).end()}catch(e){console.warn(`[language-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}var na=`open-knowledge-app`;function ra(e){let t=e.light.startsWith(`saved-`),n=e.dark.startsWith(`saved-`);return!t||!n?`incomplete`:e.light===e.dark?`same`:`different`}function ia(e){try{It.getTracer(na).startSpan(`ok.saved_themes.assignment`,{attributes:{"saved_theme.pair":ra(e)}}).end()}catch(e){console.warn(`[saved-theme-telemetry] assignment span emit failed:`,e instanceof Error?e:String(e))}}var aa=`system`;function oa(e){return typeof e==`string`&&xt.includes(e)}function sa(e){return oa(e)?e:aa}function ca(e){return new Intl.DisplayNames([e],{type:`language`}).of(e)??e}function la(e){let t=(0,Q.c)(6),{choice:n}=e;if(n===aa){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(g,{id:`D-NlUC`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=ca(n),t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,$.jsx)(`span`,{lang:n,className:`capitalize`,children:r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ua(e){let t=(0,Q.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({value:o,onValueChange:r,onBlur:n,ref:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=sa(o),t[6]=o,t[7]=s);let c=s,l;t[8]===r?l=t[9]:(l=e=>r(sa(e)),t[8]=r,t[9]=l);let u;t[10]===c?u=t[11]:(u=(0,$.jsx)(_e,{children:(0,$.jsx)(la,{choice:c})}),t[10]=c,t[11]=u);let d;t[12]!==n||t[13]!==i||t[14]!==a||t[15]!==u?(d=(0,$.jsx)(ge,{...a,ref:i,onBlur:n,size:`sm`,className:`w-48`,children:u}),t[12]=n,t[13]=i,t[14]=a,t[15]=u,t[16]=d):d=t[16];let f;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(he,{children:[(0,$.jsx)(me,{value:aa,children:(0,$.jsx)(la,{choice:aa})}),Tt.map(da)]}),t[17]=f):f=t[17];let p;return t[18]!==c||t[19]!==l||t[20]!==d?(p=(0,$.jsxs)(ve,{value:c,onValueChange:l,children:[d,f]}),t[18]=c,t[19]=l,t[20]=d,t[21]=p):p=t[21],p}function da(e){return(0,$.jsx)(me,{value:e,children:(0,$.jsx)(la,{choice:e})},e)}function fa(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 pa(e,t,n){return e.id===`custom`?fa(Ft(Fr(t))):e.scheme?fa(Ft(e.scheme)):fa(Lr(n))}function ma(e){let t=(0,Q.c)(38),{theme:n,customSeed:r,slotMode:i}=e,a,o,s,c,l,u,d,f,p,m;t[0]!==r||t[1]!==i||t[2]!==n?(a=pa(n,r,i),u=!0,d=``,f=`aspect-[4/3] w-full overflow-hidden rounded-md border`,p={backgroundColor:a.surface,borderColor:a.line},m=(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(ha),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,t[12]=m):(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],m=t[12]);let h;t[13]!==o||t[14]!==s||t[15]!==c?(h=(0,$.jsx)(`div`,{className:o,style:s,children:c}),t[13]=o,t[14]=s,t[15]=c,t[16]=h):h=t[16];let g;t[17]===a.dots[1]?g=t[18]:(g=(0,$.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-full`,style:{backgroundColor:a.dots[1]}}),t[17]=a.dots[1],t[18]=g);let _;t[19]===a.line?_=t[20]:(_=(0,$.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-full opacity-60`,style:{backgroundColor:a.line}}),t[19]=a.line,t[20]=_);let v;t[21]===a.dots[0]?v=t[22]:(v=(0,$.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-full`,style:{backgroundColor:a.dots[0]}}),t[21]=a.dots[0],t[22]=v);let y;t[23]!==g||t[24]!==_||t[25]!==v?(y=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1 px-1.5`,children:[g,_,v]}),t[23]=g,t[24]=_,t[25]=v,t[26]=y):y=t[26];let b;t[27]!==h||t[28]!==y||t[29]!==l?(b=(0,$.jsxs)(`div`,{className:l,children:[h,y]}),t[27]=h,t[28]=y,t[29]=l,t[30]=b):b=t[30];let x;return t[31]!==b||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p||t[36]!==m?(x=(0,$.jsxs)(`div`,{"aria-hidden":u,"data-theme-swatch":d,className:f,style:p,children:[m,b]}),t[31]=b,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m,t[37]=x):x=t[37],x}function ha(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function ga(e){return S(`size-6 min-w-6 rounded-md border p-0 transition-colors`,e?`border-primary bg-primary/15 text-primary hover:bg-primary/20 data-[state=on]:bg-primary/15`:`border-border/70 text-muted-foreground/70 hover:text-foreground`)}function _a(e){return S(`size-3.5`,e&&`fill-current`)}function va(e){let t=(0,Q.c)(33),{selection:n,themes:r,unavailableThemes:i,onAssign:a,editControl:o,deleteControl:s,createControl:c,slotMode:l,customSeed:u,firstItemId:f,"aria-label":p,"aria-describedby":m,"aria-invalid":h}=e,g=r===void 0?vt:r,v;t[0]===i?v=t[1]:(v=i===void 0?[]:i,t[0]=i,t[1]=v);let y=v,b=l===void 0?`light`:l,{_:C}=_(),w;if(t[2]!==C||t[3]!==u||t[4]!==s||t[5]!==o||t[6]!==f||t[7]!==a||t[8]!==n||t[9]!==b||t[10]!==g){let e;t[12]!==C||t[13]!==u||t[14]!==s||t[15]!==o||t[16]!==f||t[17]!==a||t[18]!==n||t[19]!==b?(e=(e,t)=>{let r=n.light===e.id,i=n.dark===e.id,c=o?.themeIds.includes(e.id)??!1,l=s?.themeIds.includes(e.id)??!1,p=o?.selectedId===e.id,m=C(b===`light`?{id:`hgF0al`,values:{0:e.label}}:{id:`6Nea1q`,values:{0:e.label}});return(0,$.jsxs)(`fieldset`,{"aria-label":e.label,className:S(`relative flex min-w-0 flex-col gap-1.5 rounded-lg border-2 p-1 text-left`,n[b]===e.id?`border-primary`:`border-transparent`),children:[(0,$.jsx)(A,{type:`button`,variant:`ghost`,"aria-label":m,"data-theme-focus-target":``,onClick:()=>a(b,e.id),className:`h-auto w-full cursor-pointer p-0 transition-opacity hover:bg-transparent hover:opacity-90`,children:(0,$.jsx)(ma,{theme:e,customSeed:u,slotMode:b})}),l?(0,$.jsx)(A,{type:`button`,variant:`outline`,size:`icon-sm`,title:C({id:`Y2tU6I`,values:{0:e.label}}),"aria-label":C({id:`Y2tU6I`,values:{0:e.label}}),className:`absolute top-2 end-2 z-10 border-border/80 bg-background/85 text-muted-foreground shadow-sm backdrop-blur-sm hover:border-destructive/50 hover:bg-destructive/15 hover:text-destructive focus-visible:border-destructive/50 focus-visible:text-destructive focus-visible:ring-destructive/20 dark:bg-background/80 dark:hover:bg-destructive/20`,onClick:async t=>{let n=t.currentTarget.closest(`fieldset`),r=n?.previousElementSibling?.querySelector(`[data-theme-focus-target]`)??n?.nextElementSibling?.querySelector(`[data-theme-focus-target]`);await s?.onDelete(e.id)!==!1&&r?.focus()},children:(0,$.jsx)(mr,{"aria-hidden":!0})}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-1 px-0.5`,children:[(0,$.jsx)(`span`,{className:`truncate text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[c?(0,$.jsx)(we,{className:ga(p),pressed:p,onPressedChange:t=>{o?.onSelect(t?e.id:null)},"aria-label":C(p?{id:`8x6zk9`,values:{0:e.label}}:{id:`N6j2JH`,values:{0:e.label}}),children:(0,$.jsx)(d,{className:`size-3.5`})}):null,(0,$.jsx)(we,{id:t===0?f:void 0,className:ga(r),pressed:r,onPressedChange:t=>{t&&a(`light`,e.id)},"aria-label":C({id:`sq4WQH`,values:{0:e.label}}),children:(0,$.jsx)(ur,{className:_a(r)})}),(0,$.jsx)(we,{className:ga(i),pressed:i,onPressedChange:t=>{t&&a(`dark`,e.id)},"aria-label":C({id:`lZvQrY`,values:{0:e.label}}),children:(0,$.jsx)(dr,{className:_a(i)})})]})]})]},e.id)},t[12]=C,t[13]=u,t[14]=s,t[15]=o,t[16]=f,t[17]=a,t[18]=n,t[19]=b,t[20]=e):e=t[20],w=g.map(e),t[2]=C,t[3]=u,t[4]=s,t[5]=o,t[6]=f,t[7]=a,t[8]=n,t[9]=b,t[10]=g,t[11]=w}else w=t[11];let T;t[21]!==C||t[22]!==c?(T=c?(0,$.jsxs)(A,{type:`button`,variant:`ghost`,onClick:c.onCreate,className:`group h-auto min-w-0 flex-col items-stretch gap-1.5 rounded-lg border-2 border-transparent p-1 text-left text-muted-foreground hover:bg-transparent hover:text-foreground`,children:[(0,$.jsx)(`span`,{className:`flex aspect-[4/3] w-full items-center justify-center rounded-md border border-dashed border-border bg-muted/10 transition-colors group-hover:border-foreground/40`,children:(0,$.jsx)(x,{"aria-hidden":!0,className:`size-6`})}),(0,$.jsx)(`span`,{className:`truncate px-0.5 text-1sm font-medium`,children:C({id:`AJ7_B2`})})]}):null,t[21]=C,t[22]=c,t[23]=T):T=t[23];let E;t[24]===y?E=t[25]:(E=y.map(ya),t[24]=y,t[25]=E);let D;return t[26]!==m||t[27]!==h||t[28]!==p||t[29]!==w||t[30]!==T||t[31]!==E?(D=(0,$.jsxs)(`fieldset`,{"aria-label":p,"aria-describedby":m,"aria-invalid":h,className:`grid w-full min-w-0 grid-cols-2 gap-2 sm:grid-cols-3`,children:[w,T,E]}),t[26]=m,t[27]=h,t[28]=p,t[29]=w,t[30]=T,t[31]=E,t[32]=D):D=t[32],D}function ya(e){return(0,$.jsxs)(`fieldset`,{"aria-label":e.label,className:`flex min-w-0 flex-col gap-1.5 rounded-lg border-2 border-destructive/40 bg-destructive/5 p-1 text-left`,children:[(0,$.jsx)(`div`,{"aria-hidden":!0,className:`flex aspect-[4/3] w-full items-center justify-center rounded-md border border-destructive/30 bg-muted/40 text-destructive`,children:(0,$.jsx)(mn,{className:`size-6`})}),(0,$.jsx)(`span`,{className:`truncate px-0.5 text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-destructive`,children:e.problem}),(0,$.jsx)(`span`,{className:`px-0.5 pb-0.5 text-xs text-muted-foreground`,children:e.detail})]},e.key)}var ba=12e3;function xa(e){let t=(0,Q.c)(210),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({appearance:n,onAssign:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=_(),{themes:o,warnings:s,truncated:c,loadError:l,refresh:u,deleteTheme:d,restoreTheme:f,editingThemeId:p,themeEditorOpen:m,selectThemeToEdit:h}=yr(),[g,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(!1),T=(0,Z.useRef)(null),E,D;t[4]===u?(E=t[5],D=t[6]):(E=()=>{u()},D=[u],t[4]=u,t[5]=E,t[6]=D),(0,Z.useEffect)(E,D);let O;t[7]!==n||t[8]!==o?(O=Ye(n,o),t[7]=n,t[8]=o,t[9]=O):O=t[9];let k=O,j,M,N,P,F,I,L,U,G,te,K,q,J,ne,re,ie,ae,oe,se,ce,le;if(t[10]!==a||t[11]!==x||t[12]!==y||t[13]!==g||t[14]!==d||t[15]!==p||t[16]!==C||t[17]!==l||t[18]!==r||t[19]!==i||t[20]!==u||t[21]!==f||t[22]!==h||t[23]!==k||t[24]!==m||t[25]!==o||t[26]!==c||t[27]!==s){let e=Ke(y),n;t[49]===o?n=t[50]:(n=o.filter(Ea),t[49]=o,t[50]=n);let _=n,E,D,O,H,ue,Y,de,fe,pe;if(t[51]!==a||t[52]!==y||t[53]!==d||t[54]!==p||t[55]!==_||t[56]!==C||t[57]!==l||t[58]!==r||t[59]!==i||t[60]!==u||t[61]!==f||t[62]!==h||t[63]!==k||t[64]!==m||t[65]!==o||t[66]!==c||t[67]!==s){let e=o.flatMap(Ta),n;t[80]!==a||t[81]!==u||t[82]!==f?(n=async function(e){let t=await f({id:e.id,name:e.scheme.name,stem:e.stem,scheme:{...e.scheme,palette:{...e.scheme.palette}},extension:e.filename.endsWith(`.yml`)?`.yml`:`.yaml`});if(t.ok){await u(),X.success(a({id:`Kx881F`,values:{0:e.label}}));return}if(t.reason===`name-taken`){X.error(a({id:`oZUYMv`,values:{0:e.label}}));return}X.error(a({id:`7O7REc`,values:{0:e.label}}))},t[80]=a,t[81]=u,t[82]=f,t[83]=n):n=t[83];let g=n;O=async function(t){let n=e.find(e=>e.id===t);if(!n)return X.error(a({id:`ANFxWn`})),!1;let r=await d(n.id);if(!r.ok)return X.error(a({id:`kkux8f`,values:{0:n.label}})),!1;if(p===n.id&&h(null),await u(),!r.existed)return X(a({id:`ekSPiP`,values:{0:n.label}})),!0;let i={...n,filename:r.filename,label:r.scheme.name,scheme:r.scheme};return X(a({id:`YCmS3k`,values:{0:i.label}}),{duration:ba,action:{label:a({id:`9uI_rE`}),onClick:()=>g(i)}}),!0};let x;t[84]!==a||t[85]!==y||t[86]!==C||t[87]!==r||t[88]!==i||t[89]!==u||t[90]!==f||t[91]!==h||t[92]!==k||t[93]!==o?(x=async function(e){if(e.preventDefault(),C)return;let t=Ke(y);if(!t.ok){S(a({id:`RG3yW6`})),T.current?.focus();return}let n=i.slotMode??`light`,s=o.find(e=>e.id===k[n])?.scheme??Fr(i.customSeed),c={name:t.name,variant:s.variant,palette:{...s.palette}};S(null),w(!0);let l=await f({id:t.id,name:t.name,scheme:c});if(!l.ok){S(l.reason===`name-taken`?a({id:`_IfSZn`}):l.reason===`name-invalid`?a({id:`qtnmEX`}):a({id:`DmkTrb`})),w(!1),T.current?.focus();return}let d={id:l.id,label:c.name,kind:c.variant,scheme:c,toTokens:()=>Ft(c)};r(n,l.id,k,[...o,d]),await u(),b(``),v(!1),w(!1),h(l.id)},t[84]=a,t[85]=y,t[86]=C,t[87]=r,t[88]=i,t[89]=u,t[90]=f,t[91]=h,t[92]=k,t[93]=o,t[94]=x):x=t[94],D=x;let j;if(t[95]!==a||t[96]!==s){let e;t[98]===a?e=t[99]:(e=e=>{let t;bb90:switch(e.code){case`unparseable`:t=a({id:`g12y1g`});break bb90;case`not-a-scheme`:t=a({id:`p7Utw8`});break bb90;case`missing-slots`:t=a({id:`GUZHkL`});break bb90;case`bad-hex`:t=a({id:`IMLUBh`});break bb90;case`empty`:t=a({id:`k_tFzX`});break bb90;case`too-long`:t=a({id:`FyyIjH`});break bb90;case`invalid-chars`:t=a({id:`JaU1ld`});break bb90;case`unsupported-extension-case`:t=a({id:`R30SFt`});break bb90;case`duplicate-identity`:t=a({id:`DUb7Ax`});break bb90;case`symlink`:t=a({id:`hFmYGU`});break bb90;case`not-regular-file`:t=a({id:`UH0Zqw`});break bb90;case`file-too-large`:t=a({id:`-othoN`});break bb90;case`read-failed`:t=a({id:`cLn264`});break bb90;default:t=a({id:`WBNpt9`,values:{0:e.code}})}return{key:e.filename,label:e.filename,problem:t,detail:e.conflictingFilenames?a({id:`QwG_zJ`,values:{0:e.conflictingFilenames.join(`, `)}}):a({id:`kwNS82`})}},t[98]=a,t[99]=e),j=s.map(e),t[95]=a,t[96]=s,t[97]=j}else j=t[97];let M=j;q=`flex w-full min-w-0 flex-col gap-2`,t[100]!==a||t[101]!==l||t[102]!==u?(J=l?(0,$.jsxs)(`div`,{role:`alert`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-foreground`,children:[(0,$.jsx)(`span`,{children:a({id:`hVzt9x`})}),(0,$.jsx)(A,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>void u(),children:a({id:`KDw4GX`})})]}):null,t[100]=a,t[101]=l,t[102]=u,t[103]=J):J=t[103];let N;t[104]!==a||t[105]!==c?(N=c?(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-sm text-foreground`,children:[(0,$.jsx)(hr,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-amber-600`}),(0,$.jsx)(`span`,{children:a({id:`DLIljL`})})]}):null,t[104]=a,t[105]=c,t[106]=N):N=t[106],t[107]===N?ne=t[108]:(ne=(0,$.jsx)(`div`,{role:`status`,children:N}),t[107]=N,t[108]=ne),E=va,ue=i,Y=k,de=_,fe=M;let P;t[109]===o?P=t[110]:(P=o.filter(wa).map(Ca),t[109]=o,t[110]=P);let F=m?p:null;t[111]!==h||t[112]!==P||t[113]!==F?(pe={themeIds:P,selectedId:F,onSelect:h},t[111]=h,t[112]=P,t[113]=F,t[114]=pe):pe=t[114],H=e.map(Sa),t[51]=a,t[52]=y,t[53]=d,t[54]=p,t[55]=_,t[56]=C,t[57]=l,t[58]=r,t[59]=i,t[60]=u,t[61]=f,t[62]=h,t[63]=k,t[64]=m,t[65]=o,t[66]=c,t[67]=s,t[68]=E,t[69]=D,t[70]=O,t[71]=q,t[72]=J,t[73]=ne,t[74]=H,t[75]=ue,t[76]=Y,t[77]=de,t[78]=fe,t[79]=pe}else E=t[68],D=t[69],O=t[70],q=t[71],J=t[72],ne=t[73],H=t[74],ue=t[75],Y=t[76],de=t[77],fe=t[78],pe=t[79];let me;t[115]!==O||t[116]!==H?(me={themeIds:H,onDelete:O},t[115]=O,t[116]=H,t[117]=me):me=t[117];let he;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(he={onCreate:()=>v(!0)},t[118]=he):he=t[118];let ge;t[119]!==r||t[120]!==k||t[121]!==o?(ge=(e,t)=>r(e,t,k,o),t[119]=r,t[120]=k,t[121]=o,t[122]=ge):ge=t[122],t[123]!==E||t[124]!==ue||t[125]!==Y||t[126]!==de||t[127]!==fe||t[128]!==pe||t[129]!==me||t[130]!==ge?(re=(0,$.jsx)(E,{...ue,selection:Y,themes:de,unavailableThemes:fe,editControl:pe,deleteControl:me,createControl:he,onAssign:ge}),t[123]=E,t[124]=ue,t[125]=Y,t[126]=de,t[127]=fe,t[128]=pe,t[129]=me,t[130]=ge,t[131]=re):re=t[131],F=ee,te=g,t[132]===C?K=t[133]:(K=e=>{C||v(e)},t[132]=C,t[133]=K),P=B;let _e;t[134]===a?_e=t[135]:(_e=a({id:`Z_nNa2`}),t[134]=a,t[135]=_e);let ve;t[136]===_e?ve=t[137]:(ve=(0,$.jsx)(z,{children:_e}),t[136]=_e,t[137]=ve);let ye;t[138]===a?ye=t[139]:(ye=a({id:`nTM8ab`}),t[138]=a,t[139]=ye);let be;t[140]===ye?be=t[141]:(be=(0,$.jsx)(R,{children:ye}),t[140]=ye,t[141]=be),t[142]!==ve||t[143]!==be?(G=(0,$.jsxs)(W,{className:`gap-2`,children:[ve,be]}),t[142]=ve,t[143]=be,t[144]=G):G=t[144],N=V,I=`create-saved-theme-form`,L=!0,U=D,M=Wr,se=x!==null;let xe;t[145]===a?xe=t[146]:(xe=a({id:`HZ7fEu`}),t[145]=a,t[146]=xe),t[147]===xe?ce=t[148]:(ce=(0,$.jsx)(Hr,{htmlFor:`create-saved-theme-name`,children:xe}),t[147]=xe,t[148]=ce);let Se=x!==null,Ce=x?`create-saved-theme-help create-saved-theme-error`:`create-saved-theme-help`,we;t[149]===x?we=t[150]:(we=e=>{b(e.target.value),x&&S(null)},t[149]=x,t[150]=we),t[151]!==y||t[152]!==C||t[153]!==Se||t[154]!==Ce||t[155]!==we?(le=(0,$.jsx)(Cr,{ref:T,id:`create-saved-theme-name`,value:y,autoFocus:!0,autoComplete:`off`,required:!0,readOnly:C,"aria-invalid":Se,"aria-describedby":Ce,onChange:we}),t[151]=y,t[152]=C,t[153]=Se,t[154]=Ce,t[155]=we,t[156]=le):le=t[156],j=Ur,ie=`create-saved-theme-help`,ae=`font-mono`,oe=e.ok?a({id:`Yb82LN`,values:{0:e.stem}}):a({id:`4d0VYJ`}),t[10]=a,t[11]=x,t[12]=y,t[13]=g,t[14]=d,t[15]=p,t[16]=C,t[17]=l,t[18]=r,t[19]=i,t[20]=u,t[21]=f,t[22]=h,t[23]=k,t[24]=m,t[25]=o,t[26]=c,t[27]=s,t[28]=j,t[29]=M,t[30]=N,t[31]=P,t[32]=F,t[33]=I,t[34]=L,t[35]=U,t[36]=G,t[37]=te,t[38]=K,t[39]=q,t[40]=J,t[41]=ne,t[42]=re,t[43]=ie,t[44]=ae,t[45]=oe,t[46]=se,t[47]=ce,t[48]=le}else j=t[28],M=t[29],N=t[30],P=t[31],F=t[32],I=t[33],L=t[34],U=t[35],G=t[36],te=t[37],K=t[38],q=t[39],J=t[40],ne=t[41],re=t[42],ie=t[43],ae=t[44],oe=t[45],se=t[46],ce=t[47],le=t[48];let ue;t[157]!==j||t[158]!==ie||t[159]!==ae||t[160]!==oe?(ue=(0,$.jsx)(j,{id:ie,className:ae,children:oe}),t[157]=j,t[158]=ie,t[159]=ae,t[160]=oe,t[161]=ue):ue=t[161];let Y;t[162]===x?Y=t[163]:(Y=x?(0,$.jsx)(Vr,{id:`create-saved-theme-error`,children:x}):null,t[162]=x,t[163]=Y);let de;t[164]!==M||t[165]!==ue||t[166]!==Y||t[167]!==se||t[168]!==ce||t[169]!==le?(de=(0,$.jsxs)(M,{"data-invalid":se,children:[ce,le,ue,Y]}),t[164]=M,t[165]=ue,t[166]=Y,t[167]=se,t[168]=ce,t[169]=le,t[170]=de):de=t[170];let fe;t[171]!==I||t[172]!==L||t[173]!==U||t[174]!==de?(fe=(0,$.jsx)(`form`,{id:I,noValidate:L,onSubmit:U,children:de}),t[171]=I,t[172]=L,t[173]=U,t[174]=de,t[175]=fe):fe=t[175];let pe;t[176]!==N||t[177]!==fe?(pe=(0,$.jsx)(N,{children:fe}),t[176]=N,t[177]=fe,t[178]=pe):pe=t[178];let me;t[179]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>v(!1),t[179]=me):me=t[179];let he;t[180]===a?he=t[181]:(he=a({id:`dEgA5A`}),t[180]=a,t[181]=he);let ge;t[182]!==C||t[183]!==he?(ge=(0,$.jsx)(A,{type:`button`,variant:`outline`,disabled:C,onClick:me,children:he}),t[182]=C,t[183]=he,t[184]=ge):ge=t[184];let _e;t[185]!==a||t[186]!==C?(_e=a(C?{id:`_DwR-n`}:{id:`cuHhjo`}),t[185]=a,t[186]=C,t[187]=_e):_e=t[187];let ve;t[188]!==C||t[189]!==_e?(ve=(0,$.jsx)(A,{type:`submit`,form:`create-saved-theme-form`,disabled:C,children:_e}),t[188]=C,t[189]=_e,t[190]=ve):ve=t[190];let ye;t[191]!==ge||t[192]!==ve?(ye=(0,$.jsxs)(H,{children:[ge,ve]}),t[191]=ge,t[192]=ve,t[193]=ye):ye=t[193];let be;t[194]!==P||t[195]!==G||t[196]!==pe||t[197]!==ye?(be=(0,$.jsxs)(P,{children:[G,pe,ye]}),t[194]=P,t[195]=G,t[196]=pe,t[197]=ye,t[198]=be):be=t[198];let xe;t[199]!==F||t[200]!==te||t[201]!==K||t[202]!==be?(xe=(0,$.jsx)(F,{open:te,onOpenChange:K,children:be}),t[199]=F,t[200]=te,t[201]=K,t[202]=be,t[203]=xe):xe=t[203];let Se;return t[204]!==q||t[205]!==J||t[206]!==ne||t[207]!==re||t[208]!==xe?(Se=(0,$.jsxs)(`div`,{className:q,children:[J,ne,re,xe]}),t[204]=q,t[205]=J,t[206]=ne,t[207]=re,t[208]=xe,t[209]=Se):Se=t[209],Se}function Sa(e){return e.id}function Ca(e){return e.id}function wa(e){return e.id.startsWith(`saved-`)}function Ta(e){let t=et(e.id);return!t.ok||!e.scheme?[]:[{id:e.id,stem:t.stem,label:e.label,scheme:e.scheme}]}function Ea(e){return e.id!==`custom`}function Da(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)]:Da(r,t)}}function Oa(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 ka(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 Aa(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 ja(e){let t=(0,Q.c)(14),n;t[0]===e?n=t[1]:(n=e.current(),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i={defaultValues:r,mode:`onBlur`},t[2]=r,t[3]=i);let a=hi(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{Ma(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,Z.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>Na(a,e,t),t[8]=e,t[9]=a,t[10]=c):c=t[10];let l=c,u;return t[11]!==l||t[12]!==a?(u={form:a,commitField:l},t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function Ma(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function Na(e,t,n){let r=e.getValues(n),i=Da(Ia(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(We(a.error)&&a.error.code===`SCHEMA_INVALID`&&a.error.issues.length>0){e.clearErrors(n);for(let t of a.error.issues){let r=t.path.length>0?t.path.map(String).join(`.`):n;e.setError(r,{type:`config-binding`,message:t.message})}}else e.setError(n,{type:`config-binding`,message:Pa(a.error,n)});return!1}function Pa(e,t){if(We(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>Fa(e,t));if(n)return n.message}return tt(e)}function Fa(e,t){return e.path.map(String).join(`.`)===t}function Ia(e){return e.split(`.`)}function La(e){if(!We(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 Ra(){let e=(0,Q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(qr,{className:`h-5 w-32`}),n=(0,$.jsx)(qr,{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)(qr,{className:`h-9 w-full`}),(0,$.jsx)(qr,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function za({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=_(),a=yi(),{setTheme:o}=y(),s=Jt(),c=nt(Dt,e.path),l=c?ka(c):void 0,u=c?Oa(c):void 0,d=c?Aa(c):void 0,f=c?jt(c):void 0,p=f?.scope===`project`&&t!==`project`||f?.scope===`user`&&t!==`user`,m=e.path.join(`.`),h=i(e.label),[v,b]=(0,Z.useState)(!1),x=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);let C=()=>{b(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>b(!1),1200)},w=()=>{let e=n(m);return e&&C(),e},T=()=>a.getFieldState(m).isDirty?w():!0,E=()=>{if(e.control===`theme-tiles`){let e=s?.userBinding;if(!e)return;let t=e.patch({appearance:Pr()});t.ok?C():a.setError(m,{type:`manual`,message:Pa(t.error,m)});return}let t=u===void 0?null:u;a.setValue(m,t,{shouldDirty:!1}),e.control===`theme-cards`&&o(Xt(t)),w()},D=S(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(gi,{control:a.control,name:m,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(mi,{className:D,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(vi,{className:`text-sm font-medium`,children:h}),r?(0,$.jsxs)(P,{children:[(0,$.jsx)(j,{asChild:!0,children:(0,$.jsx)(A,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:E,"aria-label":i({id:`lhjq3G`,values:{labelText:h}}),children:(0,$.jsx)(xe,{className:`size-3.5`})})}),(0,$.jsx)(M,{children:(0,$.jsx)(g,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(bi,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(_i,{children:(0,$.jsx)(Va,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:T,onRevertToBaseline:()=>a.resetField(m,{keepError:!0}),onSavedOutsideForm:C,onWriteRejected:e=>{a.setError(m,{type:`manual`,message:Pa(e,m)})}})}),(0,$.jsx)(Ga,{visible:v,srOnly:Ba(e.control)})]}),(0,$.jsx)(xi,{"data-field-error":e.path.join(`.`)})]})}})}function Ba(e){return e===`theme-tiles`||e===`theme-cards`}function Va({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,onRevertToBaseline:a,onSavedOutsideForm:o,onWriteRejected:s,...c}){"use no memo";let{_:l}=_(),{setTheme:u,systemTheme:d}=y(),f=Jt(),p=f?.merged??null;if(e.control===`language-select`)return(0,$.jsx)(ua,{...c,value:t.value,ref:t.ref,onBlur:t.onBlur,onValueChange:e=>{let n=br(t.value)??`system`;n!==e&&ta({from:n,to:e}),t.onChange(e),i()}});if(e.control===`theme-cards`){let{id:n,...r}=c;return(0,$.jsx)(fr,{...r,firstItemId:n,value:Xt(t.value),"aria-label":l(e.label),onValueChange:e=>{let n=Xt(t.value);u(e),t.onChange(e),!i()&&(u(n),a())}})}if(e.control===`theme-tiles`){let{id:t,...n}=c,r=p?.appearance?.customTheme,i=p?.appearance?.theme,a=Je(i,d===`dark`);return(0,$.jsx)(xa,{...n,firstItemId:t,appearance:p?.appearance,customSeed:r,slotMode:a,"aria-label":l(e.label),onAssign:(e,t,n,c)=>{let l=f?.userBinding;if(!l)return;let d={...n,[e]:t},p=e=>{let t=e[a];return t===`custom`?Or(Fr(r)):Dr(t,c)};Nr({selection:d,modePreference:i,slotMode:a,customSeed:r,themes:c});let m=p(d);m&&u(m);let h=l.patch({appearance:Ir(d)});if(h.ok){ia(d),o();return}Nr({selection:n,modePreference:i,slotMode:a,customSeed:r,themes:c}),u(p(n)??i??`system`),s(h.error)}})}if(n===`boolean`)return(0,$.jsx)(Se,{...c,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,...a}=c;return(0,$.jsx)(Te,{...a,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{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":l(e.label),children:r.map((e,t)=>(0,$.jsx)(Ce,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Ua,{ctl:t,onCommit:i,...c}):n===`array`?(0,$.jsx)(Wa,{ctl:t,onCommit:i,...c}):(0,$.jsx)(Ha,{ctl:t,onCommit:i,...c})}function Ha({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Cr,{...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 Ua({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Z.useState)(e.value===void 0?``:String(e.value)),a=(0,Z.useRef)(e.value);(0,Z.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)(Cr,{...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 Wa({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{B as r,Q as i,V as a,et as o,ir as s,it as c,k as l,nt as u,or as d,pi as f,rt as p,yr as m}from"./DocumentContext-cm1ZiCIR.js";import{t as h}from"./react-f2sANaYj.js";import{n as g,r as _}from"./dist-Nvb76hAm.js";import{t as v}from"./useQuery-ZeEDLtxh.js";import{n as y}from"./dist-PQ5KMVDh.js";import{t as b}from"./compiler-runtime-BfE3aGVn.js";import{i as x}from"./local-menu-action-bus-BLEUyEvu.js";import{t as S}from"./utils-CPqDy6Hr.js";import{_ as C,b as w,g as T,h as E,m as D,p as O,y as k}from"./SkillInstallMenu-DsV7Zg_N.js";import{t as A}from"./button-Cym3gapE.js";import{i as j,n as M,r as N,t as P}from"./tooltip-DttaCTqz.js";import{n as F,r as I,t as L}from"./collapsible-DYySK8La.js";import{a as R,c as z,i as B,n as V,o as H,r as U,s as W,t as ee}from"./dialog-CTNat3T_.js";import{a as G,c as te,i as K,l as q,n as J,o as ne,r as re,s as ie,t as ae}from"./alert-dialog-D9BtoYXB.js";import{Tt as oe}from"./CodeMirrorPropInput-B6CoPdiS.js";import{t as se}from"./checkbox-LVDa5cS9.js";import{n as ce,r as le}from"./terminal-cli-display-2og2-PQg.js";import{a as ue,m as Y,r as de,t as fe}from"./dropdown-menu-CRvS0_4-.js";import{t as pe}from"./label-D-K3fWtj.js";import{i as me,n as he,o as ge,s as _e,t as ve}from"./select-XEGYznMI.js";import{n as ye,t as be}from"./radio-group-npdxiS6E.js";import{n as xe}from"./separator-C6x7j8mC.js";import{t as Se}from"./switch-iwBsEWej.js";import{n as Ce,r as we,t as Te}from"./toggle-group-C2_37kV5.js";import{_ as Ee,a as De,b as Oe,c as ke,d as Ae,g as je,i as Me,l as Ne,o as Pe,p as Fe,s as Ie,t as Le,u as Re}from"./RegisteredAgentIcon-CDl1h-4U.js";import{a as ze,i as Be,o as Ve}from"./terminal-telemetry-DI0bolzP.js";import{$s as He,$t as Ue,As as We,Bn as Ge,Cs as Ke,Fs as qe,Gs as Je,Hs as Ye,Is as Xe,Kr as Ze,Ls as Qe,Ms as $e,Rs as et,Ts as tt,Us as nt,Vs as rt,Ws as it,Xr as at,Xs as ot,Yi as st,Yo as ct,_n as lt,as as ut,bo as dt,bs as ft,ct as pt,en as mt,fo as ht,gn as gt,go as _t,gs as vt,hs as yt,ls as bt,ms as xt,ns as St,nt as Ct,os as wt,ps as Tt,qs as Et,rs as Dt,st as Ot,ts as kt,uo as At,ws as jt,wt as Mt,xr as Nt,xs as Pt,ys as Ft}from"./dist-7elyeD1s.js";import{t as It}from"./trace-api-BP9dN1Hz.js";import{n as X}from"./dist-CJhtNlOm2.js";import{d as Lt,f as Rt,h as zt,n as Bt,o as Vt,p as Ht,r as Ut,u as Wt,v as Gt}from"./use-settings-route-DHPJ3RaJ.js";import{t as Kt}from"./dist-Cr4-nBVI.js";import{c as qt}from"./documents-events--JsHluy4.js";import{a as Jt,i as Yt,t as Xt}from"./use-apply-config-theme-CBmHKD_B.js";import{t as Zt}from"./createLucideIcon-BulbvLvN.js";import{a as Qt,c as $t,f as en,g as tn,l as nn,m as rn,p as an,s as on,t as sn}from"./EnableSyncConfirmDialog-DFj2_7qp.js";import{l as cn}from"./Mermaid-B4Oa2diB.js";import{t as ln}from"./arrow-up-right-BTi7mHwL.js";import{t as un}from"./check-Dut4Aov8.js";import{t as dn}from"./chevron-right-4mYNnAZZ.js";import{n as fn,t as pn}from"./lint-plugin-meta-LEBWvINg.js";import{t as mn}from"./circle-alert-b-E0_BIP.js";import{i as hn,r as gn}from"./prop-types-BOXmr7Q9.js";import{$ as _n,A as vn,B as yn,C as bn,D as xn,G as Sn,H as Cn,J as wn,K as Tn,L as En,M as Dn,N as On,O as kn,P as An,R as jn,S as Mn,U as Nn,V as Pn,W as Fn,Z as In,_ as Ln,b as Rn,c as zn,d as Bn,f as Vn,g as Hn,i as Un,j as Wn,k as Gn,l as Kn,m as qn,n as Jn,nt as Yn,o as Xn,p as Zn,q as Qn,tt as $n,v as er,x as tr,y as nr}from"./auth-state-cache-BmBuSpVr.js";import{t as rr}from"./terminal-D4HSnHXf.js";import{o as ir,s as ar,t as or}from"./use-open-skill-C2S8Ju9E.js";import{o as sr}from"./folder-config-api-D4_ApcVY.js";import{t as cr}from"./info-SlzbpjOb.js";import{t as lr}from"./spinner-t7GahFcQ.js";import{n as ur,r as dr,t as fr}from"./ThemePicker-DH1tY5im.js";import{t as pr}from"./square-pen-CBGVrQUa.js";import{t as mr}from"./trash-2-DSqYvaPJ.js";import{t as hr}from"./triangle-alert-GeclLtDN.js";import{t as gr}from"./x-DbShSCr5.js";import{d as _r}from"./doc-paths-D_8UvPYx.js";import{a as vr}from"./startup-marks-lmLF_OO-.js";import{a as yr,n as br}from"./config-provider-CTJraL6m.js";import{m as xr}from"./skills-api-DHpABbiE.js";import{a as Sr}from"./skill-scope-CVSSymVB.js";import{t as Cr}from"./input-DJ1c1x-M.js";import{a as wr,i as Tr,t as Er}from"./popover-BE6X9rKr.js";import{a as Dr,c as Or,d as kr,f as Ar,i as jr,l as Mr,n as Nr,o as Pr,p as Fr,s as Ir,u as Lr}from"./use-apply-config-color-theme-DdXME66g.js";import{t as Rr}from"./external-link-B0bVg1hn.js";import{t as zr}from"./badge-BWfmbBoh.js";import{t as Br}from"./tool-list-format-DRi3JW8x.js";import{i as Vr,o as Hr,r as Ur,t as Wr}from"./field-Di3yPBdO.js";import{t as Gr}from"./ConfigSharingInfoTooltip-BzRIZ5Ed.js";import{t as Kr}from"./use-skills-D56xe4F0.js";import{t as qr}from"./skeleton-BZIHOzZH.js";import{d as Jr,n as Yr,r as Xr,t as Zr,u as Qr}from"./lint-config-client-RAMPJ8G7.js";import{_ as $r,a as ei,d as ti,f as ni,g as ri,h as ii,i as ai,o as oi,s as si,t as ci,u as li}from"./sortable.esm-DK-jMveF.js";import{t as ui}from"./textarea-BoMa_3jF.js";import{n as di,r as fi,t as pi}from"./input-group-eVl8FXAc.js";import{a as mi,f as hi,i as gi,n as _i,o as vi,p as yi,r as bi,s as xi,t as Si}from"./form-Bz-LEGU-.js";import{r as Ci,t as wi}from"./terminal-command-events-D0gJ8NJs.js";import{t as Ti}from"./tag-pill-input-DHmb-7zU.js";import{t as Ei}from"./markdownlint-rule-browser-DitAECCM.js";import{n as Di}from"./schema-fields-view-intent-DCUTojNw.js";import{n as Oi,t as ki}from"./use-terminal-enabled-DTa27VwS.js";var Ai=Zt(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ji=Zt(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Mi=Zt(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),Ni=Zt(`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=e(h(),1),Q=b(),$=n();function Pi(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(zr,{variant:`gray`,children:(0,$.jsx)(g,{id:`YBt9YP`})}),e[0]=t):t=e[0],t}function Fi(e){let t=(0,Q.c)(10),{scope:n}=e,r=`settings-scope-badge-${n}`,i;t[0]===n?i=t[1]:(i=n===`user`?(0,$.jsx)(g,{id:`7PzzBU`}):n===`project-local`?(0,$.jsx)(g,{id:`ImTzPZ`}):(0,$.jsx)(g,{id:`e0NrBM`}),t[0]=n,t[1]=i);let a;t[2]!==r||t[3]!==i?(a=(0,$.jsx)(j,{asChild:!0,children:(0,$.jsx)(zr,{variant:`gray`,tabIndex:0,className:`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"data-testid":r,children:i})}),t[2]=r,t[3]=i,t[4]=a):a=t[4];let o;t[5]===n?o=t[6]:(o=(0,$.jsx)(M,{children:n===`user`?(0,$.jsx)(g,{id:`cFSbbh`}):n===`project-local`?(0,$.jsx)(g,{id:`YlwI5F`}):(0,$.jsx)(g,{id:`ebqMh6`})}),t[5]=n,t[6]=o);let s;return t[7]!==a||t[8]!==o?(s=(0,$.jsx)(N,{children:(0,$.jsxs)(P,{children:[a,o]})}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Ii(e){let t=(0,Q.c)(27),{titleId:n,title:r,scope:i,level:a,beta:o,adornment:s,docUrl:c,children:l}=e,u=a===void 0?`page`:a,{_:d}=_(),f=u===`page`?`h3`:`h4`,p=u===`page`?`text-lg`:`text-base`,m;t[0]===p?m=t[1]:(m=S(`font-semibold`,p),t[0]=p,t[1]=m);let h;t[2]!==f||t[3]!==m||t[4]!==r||t[5]!==n?(h=(0,$.jsx)(f,{id:n,className:m,children:r}),t[2]=f,t[3]=m,t[4]=r,t[5]=n,t[6]=h):h=t[6];let v;t[7]===o?v=t[8]:(v=o?(0,$.jsx)(Pi,{}):null,t[7]=o,t[8]=v);let y;t[9]===i?y=t[10]:(y=i?(0,$.jsx)(Fi,{scope:i}):null,t[9]=i,t[10]=y);let b;t[11]!==s||t[12]!==h||t[13]!==v||t[14]!==y?(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,s,v,y]}),t[11]=s,t[12]=h,t[13]=v,t[14]=y,t[15]=b):b=t[15];let x;t[16]===l?x=t[17]:(x=l?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l}):null,t[16]=l,t[17]=x);let C;t[18]!==d||t[19]!==c||t[20]!==r||t[21]!==n?(C=c===void 0?null:(0,$.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Rr(e,c),onAuxClick:e=>Rr(e,c),"aria-label":d(typeof r==`string`?{id:`Li4U-T`,values:{title:r}}:{id:`zwWKhA`}),className:`inline-flex items-center gap-0.5 text-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`${n}-docs-link`,children:[(0,$.jsx)(g,{id:`zwWKhA`}),(0,$.jsx)(ln,{"aria-hidden":!0,className:`size-3`})]}),t[18]=d,t[19]=c,t[20]=r,t[21]=n,t[22]=C):C=t[22];let w;return t[23]!==b||t[24]!==x||t[25]!==C?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[b,x,C]}),t[23]=b,t[24]=x,t[25]=C,t[26]=w):w=t[26],w}var Li=`settings-sharing-title`;function Ri(){let e=(0,Q.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)(zi,{}):(0,$.jsx)(Bi,{}),e[0]=n):n=e[0],n}function zi(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(g,{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":Li,className:`space-y-3`,"data-field":`section:sharing`,children:(0,$.jsx)(Ii,{titleId:Li,title:t,scope:`project`,level:`block`,children:(0,$.jsx)(g,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})}),e[1]=n):n=e[1],n}function Bi(){let e=(0,Q.c)(29),{_:t}=_(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c;e[0]===t?c=e[1]:(c=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(Hi)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Z.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({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 l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ii,{titleId:Li,title:(0,$.jsx)(g,{id:`cs4mps`}),scope:`project`,level:`block`}),e[10]=t):t=e[10];let n;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`section`,{"aria-labelledby":Li,className:`space-y-3`,"data-field":`section:sharing`,children:[t,(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(g,{id:`eQn7nI`})}),(0,$.jsx)(qr,{className:`h-24`})]})]}),e[11]=n):n=e[11],n}let m=n.mode===`no-git`,h;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(g,{id:`cs4mps`}),e[12]=h):h=e[12];let v;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(Ii,{titleId:Li,title:h,scope:`project`,level:`block`,adornment:(0,$.jsx)(Gr,{}),children:(0,$.jsx)(g,{id:`N55YNr`})}),e[13]=v):v=e[13];let y;e[14]!==i||e[15]!==m||e[16]!==p||e[17]!==n.mode?(y=m?(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)(g,{id:`ju38ms`})}):(0,$.jsxs)(be,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Li,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(ye,{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)(g,{id:`QjzFZj`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(g,{id:`un-K1H`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(ye,{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)(g,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(g,{id:`dJw2_7`})})]})]})]}),e[14]=i,e[15]=m,e[16]=p,e[17]=n.mode,e[18]=y):y=e[18];let b;e[19]===o?b=e[20]:(b=o===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)(g,{id:`ZscwQ0`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(g,{id:`1QfxQT`})})]}),e[19]=o,e[20]=b);let x;e[21]!==o||e[22]!==n.mode||e[23]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===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)(g,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(Vi)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(g,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[21]=o,e[22]=n.mode,e[23]=n.trackedUpstream,e[24]=x):x=e[24];let S;return e[25]!==y||e[26]!==b||e[27]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":Li,className:`space-y-4`,"data-testid":`settings-sharing`,"data-field":`section:sharing`,children:[v,y,b,x]}),e[25]=y,e[26]=b,e[27]=x,e[28]=S):S=e[28],S}function Vi(e){return(0,$.jsx)(`li`,{children:e},e)}function Hi(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}function Ui(e){let t=(0,Q.c)(35),{authQueryTransport:n,authTransport:r}=e,{_:i}=_(),a;t[0]===n?a=t[1]:(a=n??In(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Z.useState)(s),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),v=(0,Z.useRef)(!1),y;t[3]===o?y=t[4]:(y=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),Jn(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=y);let b=y,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[7]=S):S=t[7],(0,Z.useEffect)(x,S);let C;t[8]!==i||t[9]!==b||t[10]!==o?(C=async function(){if(v.current)return;v.current=!0,d(!1),p(!0),h(null);let e=null;try{let t=o.signout?await o.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&&h(e),p(!1),v.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=C):C=t[11];let w=C,T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(g,{id:`AeXO77`}),t[12]=T):T=t[12];let E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Ii,{titleId:`settings-account-title`,title:T,scope:`user`,children:(0,$.jsx)(g,{id:`E6lrpp`})}),t[13]=E):E=t[13];let D;t[14]!==m||t[15]!==f||t[16]!==w||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(D=c.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)(g,{id:`IWGfGF`})}),(0,$.jsx)(qr,{className:`h-4 w-40`}),(0,$.jsx)(qr,{className:`h-8 w-32`})]}):c.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)(g,{id:`T_wG4n`})}),(0,$.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(g,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(Gi,{login:c.result.login}):(0,$.jsx)(Wi,{login:c.result.login,disconnecting:f,error:m,onDisconnect:()=>void w()}):(0,$.jsx)(Ki,{onConnect:()=>d(!0)}),t[14]=m,t[15]=f,t[16]=w,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=D):D=t[20];let O;t[21]===b?O=t[22]:(O=e=>{d(e),e||b()},t[21]=b,t[22]=O);let k=c.phase===`loaded`?c.result.host:void 0,j=c.phase===`loaded`?c.result.ghAvailable:void 0,M;t[23]===b?M=t[24]:(M=()=>{b()},t[23]=b,t[24]=M);let N;t[25]!==u||t[26]!==r||t[27]!==O||t[28]!==k||t[29]!==j||t[30]!==M?(N=(0,$.jsx)(wn,{open:u,onOpenChange:O,transport:r,host:k,ghAvailable:j,onSuccess:M}),t[25]=u,t[26]=r,t[27]=O,t[28]=k,t[29]=j,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==N||t[33]!==D?(P=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[E,D,N]}),t[32]=N,t[33]=D,t[34]=P):P=t[34],P}function Wi(e){let t=(0,Q.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(g,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(g,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(g,{id:`rppgXF`}):(0,$.jsx)(g,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(A,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(g,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=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]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function Gi(e){let t=(0,Q.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(g,{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)(g,{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 Ki(e){let t=(0,Q.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)(g,{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)(g,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(g,{id:`5lWFkC`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(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)(A,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function qi(e,t){let n=e=>e.state!==`not-installed`||e.detected,r=e.filter(n),i=r.length>0&&r.length<e.length;return{shownEditors:!i||t?[...e].sort((e,t)=>Number(n(t))-Number(n(e))):r,hiddenCount:i?e.length-r.length:0}}function Ji(e){let t=(0,Q.c)(9),{hiddenCount:n,expanded:r,onToggle:i,testId:a}=e,{_:o}=_();if(n===0)return null;let s;t[0]!==o||t[1]!==r||t[2]!==n?(s=o(r?{id:`6lGV3K`}:{id:`INN7OX`,values:{hiddenCount:n}}),t[0]=o,t[1]=r,t[2]=n,t[3]=s):s=t[3];let c;return t[4]!==r||t[5]!==i||t[6]!==s||t[7]!==a?(c=(0,$.jsx)(`li`,{children:(0,$.jsx)(A,{type:`button`,variant:`ghost`,"aria-expanded":r,onClick:i,className:`w-full justify-center rounded-none font-normal text-muted-foreground text-xs`,"data-testid":a,children:s})}),t[4]=r,t[5]=i,t[6]=s,t[7]=a,t[8]=c):c=t[8],c}function Yi(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function Xi(e){let t=(0,Q.c)(11),{testId:n,children:r}=e,{_:i}=_(),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)(cr,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(j,{asChild:!0,children:(0,$.jsx)(A,{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]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=(0,$.jsx)(M,{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]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(P,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Zi(){let e=(0,Q.c)(61),{_:t}=_(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(!1),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||o(!0)}),()=>{e=!0}},f=[n],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Z.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=async function(e,r){if(n){c(Yi(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)}}))}c(null)}},e[2]=t,e[3]=p);let m=p,h,v,y,b,x,S,C,w,T,E,D;if(e[4]!==t||e[5]!==m||e[6]!==a||e[7]!==s||e[8]!==l||e[9]!==r){b=Symbol.for(`react.early_return_sentinel`);bb0:{let i;e[21]===r?.editors?i=e[22]:(i=r?.editors??[],e[21]=r?.editors,e[22]=i);let{shownEditors:o,hiddenCount:c}=qi(i,l);h=c;let u;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(g,{id:`_5qBNl`}),e[23]=u):u=e[23];let d;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(Ii,{titleId:`settings-ai-tools-title`,title:u,scope:`user`,children:(0,$.jsx)(g,{id:`mLAjyL`})}),e[24]=d):d=e[24];let f=d;if(!n||a){let t;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[f,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(g,{id:`O4PnDd`})})]}),e[25]=t):t=e[25],b=t;break bb0}if(r===null){let t;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-ai-tools-title`,className:`space-y-4`,children:[f,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(qr,{className:`h-10 w-full`}),(0,$.jsx)(qr,{className:`h-10 w-full`}),(0,$.jsx)(qr,{className:`h-10 w-full`})]})]}),e[26]=t):t=e[26],b=t;break bb0}let p=s!==null||!r.available,_=r.path.shellDetected||r.path.installed;T=`settings-ai-tools-title`,E=`space-y-4`,D=f,e[27]===r.available?v=e[28]:(v=!r.available&&(0,$.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,"data-testid":`ai-tools-read-only`,children:(0,$.jsx)(g,{id:`OplnBG`})}),e[27]=r.available,e[28]=v),e[29]!==t||e[30]!==m||e[31]!==p||e[32]!==_||e[33]!==r.path.installed||e[34]!==r.path.rcFilesToTouch?(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)(g,{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)(pe,{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)(se,{id:`ai-tools-path`,checked:r.path.installed,disabled:p,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)(g,{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?n.config.ptyAvailable===!0?t({id:`yhdqox`}):t({id:`XEfNPL`}):t({id:`04XyCH`,values:{0:r.path.rcFilesToTouch.join(`, `)}})})]})]}),(0,$.jsxs)(Xi,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(g,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map($i),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(g,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[29]=t,e[30]=m,e[31]=p,e[32]=_,e[33]=r.path.installed,e[34]=r.path.rcFilesToTouch,e[35]=y):y=e[35],C=`flex flex-col gap-1.5`,e[36]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:(0,$.jsx)(g,{id:`psfGPX`})}),e[36]=w):w=e[36],x=`rounded-md border border-border bg-card/50 divide-y divide-border overflow-hidden`;let O;e[37]!==t||e[38]!==m||e[39]!==p?(O=e=>{let n=e.state===`installed`||e.state===`foreign`,r=p||e.state===`unmanageable`,i=e.state===`not-installed`,a=`https://openknowledge.ai/docs/integrations/${_t[e.id]}`,o=e.state===`installed`?t({id:`eQkgKV`}):e.state===`foreign`?t({id:`AczYxH`}):e.state===`unmanageable`?t({id:`LbmLyU`}):null,s=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)(pe,{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)(se,{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}),o!==null&&(0,$.jsx)(`span`,{className:s,"data-testid":`ai-tools-editor-status-${e.id}`,children:o})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Rr(e,a),onAuxClick:e=>Rr(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)(g,{id:`P_bX4O`}),(0,$.jsx)(ln,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(Xi,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(g,{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)(g,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[37]=t,e[38]=m,e[39]=p,e[40]=O):O=e[40],S=o.map(O)}e[4]=t,e[5]=m,e[6]=a,e[7]=s,e[8]=l,e[9]=r,e[10]=h,e[11]=v,e[12]=y,e[13]=b,e[14]=x,e[15]=S,e[16]=C,e[17]=w,e[18]=T,e[19]=E,e[20]=D}else h=e[10],v=e[11],y=e[12],b=e[13],x=e[14],S=e[15],C=e[16],w=e[17],T=e[18],E=e[19],D=e[20];if(b!==Symbol.for(`react.early_return_sentinel`))return b;let O;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>u(Qi),e[41]=O):O=e[41];let k;e[42]!==h||e[43]!==l?(k=(0,$.jsx)(Ji,{hiddenCount:h,expanded:l,onToggle:O,testId:`ai-tools-editors-show-more`}),e[42]=h,e[43]=l,e[44]=k):k=e[44];let A;e[45]!==k||e[46]!==x||e[47]!==S?(A=(0,$.jsxs)(`ul`,{className:x,children:[S,k]}),e[45]=k,e[46]=x,e[47]=S,e[48]=A):A=e[48];let j;e[49]!==A||e[50]!==C||e[51]!==w?(j=(0,$.jsxs)(`div`,{className:C,children:[w,A]}),e[49]=A,e[50]=C,e[51]=w,e[52]=j):j=e[52];let M;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`ai-tools-skills-moved`,children:(0,$.jsx)(g,{id:`iKS6gg`})}),e[53]=M):M=e[53];let N;return e[54]!==v||e[55]!==y||e[56]!==j||e[57]!==T||e[58]!==E||e[59]!==D?(N=(0,$.jsxs)(`section`,{"aria-labelledby":T,className:E,children:[D,v,y,j,M]}),e[54]=v,e[55]=y,e[56]=j,e[57]=T,e[58]=E,e[59]=D,e[60]=N):N=e[60],N}function Qi(e){return!e}function $i(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}var ea=`open-knowledge-app`;function ta({from:e,to:t}){try{It.getTracer(ea).startSpan(`ok.language.preferenceChanged`,{attributes:{"ok.language.from":e,"ok.language.to":t}}).end()}catch(e){console.warn(`[language-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}var na=`open-knowledge-app`;function ra(e){let t=e.light.startsWith(`saved-`),n=e.dark.startsWith(`saved-`);return!t||!n?`incomplete`:e.light===e.dark?`same`:`different`}function ia(e){try{It.getTracer(na).startSpan(`ok.saved_themes.assignment`,{attributes:{"saved_theme.pair":ra(e)}}).end()}catch(e){console.warn(`[saved-theme-telemetry] assignment span emit failed:`,e instanceof Error?e:String(e))}}var aa=`system`;function oa(e){return typeof e==`string`&&xt.includes(e)}function sa(e){return oa(e)?e:aa}function ca(e){return new Intl.DisplayNames([e],{type:`language`}).of(e)??e}function la(e){let t=(0,Q.c)(6),{choice:n}=e;if(n===aa){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(g,{id:`D-NlUC`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=ca(n),t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,$.jsx)(`span`,{lang:n,className:`capitalize`,children:r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ua(e){let t=(0,Q.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({value:o,onValueChange:r,onBlur:n,ref:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=sa(o),t[6]=o,t[7]=s);let c=s,l;t[8]===r?l=t[9]:(l=e=>r(sa(e)),t[8]=r,t[9]=l);let u;t[10]===c?u=t[11]:(u=(0,$.jsx)(_e,{children:(0,$.jsx)(la,{choice:c})}),t[10]=c,t[11]=u);let d;t[12]!==n||t[13]!==i||t[14]!==a||t[15]!==u?(d=(0,$.jsx)(ge,{...a,ref:i,onBlur:n,size:`sm`,className:`w-48`,children:u}),t[12]=n,t[13]=i,t[14]=a,t[15]=u,t[16]=d):d=t[16];let f;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(he,{children:[(0,$.jsx)(me,{value:aa,children:(0,$.jsx)(la,{choice:aa})}),Tt.map(da)]}),t[17]=f):f=t[17];let p;return t[18]!==c||t[19]!==l||t[20]!==d?(p=(0,$.jsxs)(ve,{value:c,onValueChange:l,children:[d,f]}),t[18]=c,t[19]=l,t[20]=d,t[21]=p):p=t[21],p}function da(e){return(0,$.jsx)(me,{value:e,children:(0,$.jsx)(la,{choice:e})},e)}function fa(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 pa(e,t,n){return e.id===`custom`?fa(Ft(Fr(t))):e.scheme?fa(Ft(e.scheme)):fa(Lr(n))}function ma(e){let t=(0,Q.c)(38),{theme:n,customSeed:r,slotMode:i}=e,a,o,s,c,l,u,d,f,p,m;t[0]!==r||t[1]!==i||t[2]!==n?(a=pa(n,r,i),u=!0,d=``,f=`aspect-[4/3] w-full overflow-hidden rounded-md border`,p={backgroundColor:a.surface,borderColor:a.line},m=(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(ha),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,t[12]=m):(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],m=t[12]);let h;t[13]!==o||t[14]!==s||t[15]!==c?(h=(0,$.jsx)(`div`,{className:o,style:s,children:c}),t[13]=o,t[14]=s,t[15]=c,t[16]=h):h=t[16];let g;t[17]===a.dots[1]?g=t[18]:(g=(0,$.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-full`,style:{backgroundColor:a.dots[1]}}),t[17]=a.dots[1],t[18]=g);let _;t[19]===a.line?_=t[20]:(_=(0,$.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-full opacity-60`,style:{backgroundColor:a.line}}),t[19]=a.line,t[20]=_);let v;t[21]===a.dots[0]?v=t[22]:(v=(0,$.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-full`,style:{backgroundColor:a.dots[0]}}),t[21]=a.dots[0],t[22]=v);let y;t[23]!==g||t[24]!==_||t[25]!==v?(y=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1 px-1.5`,children:[g,_,v]}),t[23]=g,t[24]=_,t[25]=v,t[26]=y):y=t[26];let b;t[27]!==h||t[28]!==y||t[29]!==l?(b=(0,$.jsxs)(`div`,{className:l,children:[h,y]}),t[27]=h,t[28]=y,t[29]=l,t[30]=b):b=t[30];let x;return t[31]!==b||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p||t[36]!==m?(x=(0,$.jsxs)(`div`,{"aria-hidden":u,"data-theme-swatch":d,className:f,style:p,children:[m,b]}),t[31]=b,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m,t[37]=x):x=t[37],x}function ha(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function ga(e){return S(`size-6 min-w-6 rounded-md border p-0 transition-colors`,e?`border-primary bg-primary/15 text-primary hover:bg-primary/20 data-[state=on]:bg-primary/15`:`border-border/70 text-muted-foreground/70 hover:text-foreground`)}function _a(e){return S(`size-3.5`,e&&`fill-current`)}function va(e){let t=(0,Q.c)(33),{selection:n,themes:r,unavailableThemes:i,onAssign:a,editControl:o,deleteControl:s,createControl:c,slotMode:l,customSeed:u,firstItemId:f,"aria-label":p,"aria-describedby":m,"aria-invalid":h}=e,g=r===void 0?vt:r,v;t[0]===i?v=t[1]:(v=i===void 0?[]:i,t[0]=i,t[1]=v);let y=v,b=l===void 0?`light`:l,{_:C}=_(),w;if(t[2]!==C||t[3]!==u||t[4]!==s||t[5]!==o||t[6]!==f||t[7]!==a||t[8]!==n||t[9]!==b||t[10]!==g){let e;t[12]!==C||t[13]!==u||t[14]!==s||t[15]!==o||t[16]!==f||t[17]!==a||t[18]!==n||t[19]!==b?(e=(e,t)=>{let r=n.light===e.id,i=n.dark===e.id,c=o?.themeIds.includes(e.id)??!1,l=s?.themeIds.includes(e.id)??!1,p=o?.selectedId===e.id,m=C(b===`light`?{id:`hgF0al`,values:{0:e.label}}:{id:`6Nea1q`,values:{0:e.label}});return(0,$.jsxs)(`fieldset`,{"aria-label":e.label,className:S(`relative flex min-w-0 flex-col gap-1.5 rounded-lg border-2 p-1 text-left`,n[b]===e.id?`border-primary`:`border-transparent`),children:[(0,$.jsx)(A,{type:`button`,variant:`ghost`,"aria-label":m,"data-theme-focus-target":``,onClick:()=>a(b,e.id),className:`h-auto w-full cursor-pointer p-0 transition-opacity hover:bg-transparent hover:opacity-90`,children:(0,$.jsx)(ma,{theme:e,customSeed:u,slotMode:b})}),l?(0,$.jsx)(A,{type:`button`,variant:`outline`,size:`icon-sm`,title:C({id:`Y2tU6I`,values:{0:e.label}}),"aria-label":C({id:`Y2tU6I`,values:{0:e.label}}),className:`absolute top-2 end-2 z-10 border-border/80 bg-background/85 text-muted-foreground shadow-sm backdrop-blur-sm hover:border-destructive/50 hover:bg-destructive/15 hover:text-destructive focus-visible:border-destructive/50 focus-visible:text-destructive focus-visible:ring-destructive/20 dark:bg-background/80 dark:hover:bg-destructive/20`,onClick:async t=>{let n=t.currentTarget.closest(`fieldset`),r=n?.previousElementSibling?.querySelector(`[data-theme-focus-target]`)??n?.nextElementSibling?.querySelector(`[data-theme-focus-target]`);await s?.onDelete(e.id)!==!1&&r?.focus()},children:(0,$.jsx)(mr,{"aria-hidden":!0})}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-1 px-0.5`,children:[(0,$.jsx)(`span`,{className:`truncate text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[c?(0,$.jsx)(we,{className:ga(p),pressed:p,onPressedChange:t=>{o?.onSelect(t?e.id:null)},"aria-label":C(p?{id:`8x6zk9`,values:{0:e.label}}:{id:`N6j2JH`,values:{0:e.label}}),children:(0,$.jsx)(d,{className:`size-3.5`})}):null,(0,$.jsx)(we,{id:t===0?f:void 0,className:ga(r),pressed:r,onPressedChange:t=>{t&&a(`light`,e.id)},"aria-label":C({id:`sq4WQH`,values:{0:e.label}}),children:(0,$.jsx)(ur,{className:_a(r)})}),(0,$.jsx)(we,{className:ga(i),pressed:i,onPressedChange:t=>{t&&a(`dark`,e.id)},"aria-label":C({id:`lZvQrY`,values:{0:e.label}}),children:(0,$.jsx)(dr,{className:_a(i)})})]})]})]},e.id)},t[12]=C,t[13]=u,t[14]=s,t[15]=o,t[16]=f,t[17]=a,t[18]=n,t[19]=b,t[20]=e):e=t[20],w=g.map(e),t[2]=C,t[3]=u,t[4]=s,t[5]=o,t[6]=f,t[7]=a,t[8]=n,t[9]=b,t[10]=g,t[11]=w}else w=t[11];let T;t[21]!==C||t[22]!==c?(T=c?(0,$.jsxs)(A,{type:`button`,variant:`ghost`,onClick:c.onCreate,className:`group h-auto min-w-0 flex-col items-stretch gap-1.5 rounded-lg border-2 border-transparent p-1 text-left text-muted-foreground hover:bg-transparent hover:text-foreground`,children:[(0,$.jsx)(`span`,{className:`flex aspect-[4/3] w-full items-center justify-center rounded-md border border-dashed border-border bg-muted/10 transition-colors group-hover:border-foreground/40`,children:(0,$.jsx)(x,{"aria-hidden":!0,className:`size-6`})}),(0,$.jsx)(`span`,{className:`truncate px-0.5 text-1sm font-medium`,children:C({id:`AJ7_B2`})})]}):null,t[21]=C,t[22]=c,t[23]=T):T=t[23];let E;t[24]===y?E=t[25]:(E=y.map(ya),t[24]=y,t[25]=E);let D;return t[26]!==m||t[27]!==h||t[28]!==p||t[29]!==w||t[30]!==T||t[31]!==E?(D=(0,$.jsxs)(`fieldset`,{"aria-label":p,"aria-describedby":m,"aria-invalid":h,className:`grid w-full min-w-0 grid-cols-2 gap-2 sm:grid-cols-3`,children:[w,T,E]}),t[26]=m,t[27]=h,t[28]=p,t[29]=w,t[30]=T,t[31]=E,t[32]=D):D=t[32],D}function ya(e){return(0,$.jsxs)(`fieldset`,{"aria-label":e.label,className:`flex min-w-0 flex-col gap-1.5 rounded-lg border-2 border-destructive/40 bg-destructive/5 p-1 text-left`,children:[(0,$.jsx)(`div`,{"aria-hidden":!0,className:`flex aspect-[4/3] w-full items-center justify-center rounded-md border border-destructive/30 bg-muted/40 text-destructive`,children:(0,$.jsx)(mn,{className:`size-6`})}),(0,$.jsx)(`span`,{className:`truncate px-0.5 text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-destructive`,children:e.problem}),(0,$.jsx)(`span`,{className:`px-0.5 pb-0.5 text-xs text-muted-foreground`,children:e.detail})]},e.key)}var ba=12e3;function xa(e){let t=(0,Q.c)(210),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({appearance:n,onAssign:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=_(),{themes:o,warnings:s,truncated:c,loadError:l,refresh:u,deleteTheme:d,restoreTheme:f,editingThemeId:p,themeEditorOpen:m,selectThemeToEdit:h}=yr(),[g,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(!1),T=(0,Z.useRef)(null),E,D;t[4]===u?(E=t[5],D=t[6]):(E=()=>{u()},D=[u],t[4]=u,t[5]=E,t[6]=D),(0,Z.useEffect)(E,D);let O;t[7]!==n||t[8]!==o?(O=Ye(n,o),t[7]=n,t[8]=o,t[9]=O):O=t[9];let k=O,j,M,N,P,F,I,L,U,G,te,K,q,J,ne,re,ie,ae,oe,se,ce,le;if(t[10]!==a||t[11]!==x||t[12]!==y||t[13]!==g||t[14]!==d||t[15]!==p||t[16]!==C||t[17]!==l||t[18]!==r||t[19]!==i||t[20]!==u||t[21]!==f||t[22]!==h||t[23]!==k||t[24]!==m||t[25]!==o||t[26]!==c||t[27]!==s){let e=Ke(y),n;t[49]===o?n=t[50]:(n=o.filter(Ea),t[49]=o,t[50]=n);let _=n,E,D,O,H,ue,Y,de,fe,pe;if(t[51]!==a||t[52]!==y||t[53]!==d||t[54]!==p||t[55]!==_||t[56]!==C||t[57]!==l||t[58]!==r||t[59]!==i||t[60]!==u||t[61]!==f||t[62]!==h||t[63]!==k||t[64]!==m||t[65]!==o||t[66]!==c||t[67]!==s){let e=o.flatMap(Ta),n;t[80]!==a||t[81]!==u||t[82]!==f?(n=async function(e){let t=await f({id:e.id,name:e.scheme.name,stem:e.stem,scheme:{...e.scheme,palette:{...e.scheme.palette}},extension:e.filename.endsWith(`.yml`)?`.yml`:`.yaml`});if(t.ok){await u(),X.success(a({id:`Kx881F`,values:{0:e.label}}));return}if(t.reason===`name-taken`){X.error(a({id:`oZUYMv`,values:{0:e.label}}));return}X.error(a({id:`7O7REc`,values:{0:e.label}}))},t[80]=a,t[81]=u,t[82]=f,t[83]=n):n=t[83];let g=n;O=async function(t){let n=e.find(e=>e.id===t);if(!n)return X.error(a({id:`ANFxWn`})),!1;let r=await d(n.id);if(!r.ok)return X.error(a({id:`kkux8f`,values:{0:n.label}})),!1;if(p===n.id&&h(null),await u(),!r.existed)return X(a({id:`ekSPiP`,values:{0:n.label}})),!0;let i={...n,filename:r.filename,label:r.scheme.name,scheme:r.scheme};return X(a({id:`YCmS3k`,values:{0:i.label}}),{duration:ba,action:{label:a({id:`9uI_rE`}),onClick:()=>g(i)}}),!0};let x;t[84]!==a||t[85]!==y||t[86]!==C||t[87]!==r||t[88]!==i||t[89]!==u||t[90]!==f||t[91]!==h||t[92]!==k||t[93]!==o?(x=async function(e){if(e.preventDefault(),C)return;let t=Ke(y);if(!t.ok){S(a({id:`RG3yW6`})),T.current?.focus();return}let n=i.slotMode??`light`,s=o.find(e=>e.id===k[n])?.scheme??Fr(i.customSeed),c={name:t.name,variant:s.variant,palette:{...s.palette}};S(null),w(!0);let l=await f({id:t.id,name:t.name,scheme:c});if(!l.ok){S(l.reason===`name-taken`?a({id:`_IfSZn`}):l.reason===`name-invalid`?a({id:`qtnmEX`}):a({id:`DmkTrb`})),w(!1),T.current?.focus();return}let d={id:l.id,label:c.name,kind:c.variant,scheme:c,toTokens:()=>Ft(c)};r(n,l.id,k,[...o,d]),await u(),b(``),v(!1),w(!1),h(l.id)},t[84]=a,t[85]=y,t[86]=C,t[87]=r,t[88]=i,t[89]=u,t[90]=f,t[91]=h,t[92]=k,t[93]=o,t[94]=x):x=t[94],D=x;let j;if(t[95]!==a||t[96]!==s){let e;t[98]===a?e=t[99]:(e=e=>{let t;bb90:switch(e.code){case`unparseable`:t=a({id:`g12y1g`});break bb90;case`not-a-scheme`:t=a({id:`p7Utw8`});break bb90;case`missing-slots`:t=a({id:`GUZHkL`});break bb90;case`bad-hex`:t=a({id:`IMLUBh`});break bb90;case`empty`:t=a({id:`k_tFzX`});break bb90;case`too-long`:t=a({id:`FyyIjH`});break bb90;case`invalid-chars`:t=a({id:`JaU1ld`});break bb90;case`unsupported-extension-case`:t=a({id:`R30SFt`});break bb90;case`duplicate-identity`:t=a({id:`DUb7Ax`});break bb90;case`symlink`:t=a({id:`hFmYGU`});break bb90;case`not-regular-file`:t=a({id:`UH0Zqw`});break bb90;case`file-too-large`:t=a({id:`-othoN`});break bb90;case`read-failed`:t=a({id:`cLn264`});break bb90;default:t=a({id:`WBNpt9`,values:{0:e.code}})}return{key:e.filename,label:e.filename,problem:t,detail:e.conflictingFilenames?a({id:`QwG_zJ`,values:{0:e.conflictingFilenames.join(`, `)}}):a({id:`kwNS82`})}},t[98]=a,t[99]=e),j=s.map(e),t[95]=a,t[96]=s,t[97]=j}else j=t[97];let M=j;q=`flex w-full min-w-0 flex-col gap-2`,t[100]!==a||t[101]!==l||t[102]!==u?(J=l?(0,$.jsxs)(`div`,{role:`alert`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-foreground`,children:[(0,$.jsx)(`span`,{children:a({id:`hVzt9x`})}),(0,$.jsx)(A,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>void u(),children:a({id:`KDw4GX`})})]}):null,t[100]=a,t[101]=l,t[102]=u,t[103]=J):J=t[103];let N;t[104]!==a||t[105]!==c?(N=c?(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-sm text-foreground`,children:[(0,$.jsx)(hr,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-amber-600`}),(0,$.jsx)(`span`,{children:a({id:`DLIljL`})})]}):null,t[104]=a,t[105]=c,t[106]=N):N=t[106],t[107]===N?ne=t[108]:(ne=(0,$.jsx)(`div`,{role:`status`,children:N}),t[107]=N,t[108]=ne),E=va,ue=i,Y=k,de=_,fe=M;let P;t[109]===o?P=t[110]:(P=o.filter(wa).map(Ca),t[109]=o,t[110]=P);let F=m?p:null;t[111]!==h||t[112]!==P||t[113]!==F?(pe={themeIds:P,selectedId:F,onSelect:h},t[111]=h,t[112]=P,t[113]=F,t[114]=pe):pe=t[114],H=e.map(Sa),t[51]=a,t[52]=y,t[53]=d,t[54]=p,t[55]=_,t[56]=C,t[57]=l,t[58]=r,t[59]=i,t[60]=u,t[61]=f,t[62]=h,t[63]=k,t[64]=m,t[65]=o,t[66]=c,t[67]=s,t[68]=E,t[69]=D,t[70]=O,t[71]=q,t[72]=J,t[73]=ne,t[74]=H,t[75]=ue,t[76]=Y,t[77]=de,t[78]=fe,t[79]=pe}else E=t[68],D=t[69],O=t[70],q=t[71],J=t[72],ne=t[73],H=t[74],ue=t[75],Y=t[76],de=t[77],fe=t[78],pe=t[79];let me;t[115]!==O||t[116]!==H?(me={themeIds:H,onDelete:O},t[115]=O,t[116]=H,t[117]=me):me=t[117];let he;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(he={onCreate:()=>v(!0)},t[118]=he):he=t[118];let ge;t[119]!==r||t[120]!==k||t[121]!==o?(ge=(e,t)=>r(e,t,k,o),t[119]=r,t[120]=k,t[121]=o,t[122]=ge):ge=t[122],t[123]!==E||t[124]!==ue||t[125]!==Y||t[126]!==de||t[127]!==fe||t[128]!==pe||t[129]!==me||t[130]!==ge?(re=(0,$.jsx)(E,{...ue,selection:Y,themes:de,unavailableThemes:fe,editControl:pe,deleteControl:me,createControl:he,onAssign:ge}),t[123]=E,t[124]=ue,t[125]=Y,t[126]=de,t[127]=fe,t[128]=pe,t[129]=me,t[130]=ge,t[131]=re):re=t[131],F=ee,te=g,t[132]===C?K=t[133]:(K=e=>{C||v(e)},t[132]=C,t[133]=K),P=B;let _e;t[134]===a?_e=t[135]:(_e=a({id:`Z_nNa2`}),t[134]=a,t[135]=_e);let ve;t[136]===_e?ve=t[137]:(ve=(0,$.jsx)(z,{children:_e}),t[136]=_e,t[137]=ve);let ye;t[138]===a?ye=t[139]:(ye=a({id:`nTM8ab`}),t[138]=a,t[139]=ye);let be;t[140]===ye?be=t[141]:(be=(0,$.jsx)(R,{children:ye}),t[140]=ye,t[141]=be),t[142]!==ve||t[143]!==be?(G=(0,$.jsxs)(W,{className:`gap-2`,children:[ve,be]}),t[142]=ve,t[143]=be,t[144]=G):G=t[144],N=V,I=`create-saved-theme-form`,L=!0,U=D,M=Wr,se=x!==null;let xe;t[145]===a?xe=t[146]:(xe=a({id:`HZ7fEu`}),t[145]=a,t[146]=xe),t[147]===xe?ce=t[148]:(ce=(0,$.jsx)(Hr,{htmlFor:`create-saved-theme-name`,children:xe}),t[147]=xe,t[148]=ce);let Se=x!==null,Ce=x?`create-saved-theme-help create-saved-theme-error`:`create-saved-theme-help`,we;t[149]===x?we=t[150]:(we=e=>{b(e.target.value),x&&S(null)},t[149]=x,t[150]=we),t[151]!==y||t[152]!==C||t[153]!==Se||t[154]!==Ce||t[155]!==we?(le=(0,$.jsx)(Cr,{ref:T,id:`create-saved-theme-name`,value:y,autoFocus:!0,autoComplete:`off`,required:!0,readOnly:C,"aria-invalid":Se,"aria-describedby":Ce,onChange:we}),t[151]=y,t[152]=C,t[153]=Se,t[154]=Ce,t[155]=we,t[156]=le):le=t[156],j=Ur,ie=`create-saved-theme-help`,ae=`font-mono`,oe=e.ok?a({id:`Yb82LN`,values:{0:e.stem}}):a({id:`4d0VYJ`}),t[10]=a,t[11]=x,t[12]=y,t[13]=g,t[14]=d,t[15]=p,t[16]=C,t[17]=l,t[18]=r,t[19]=i,t[20]=u,t[21]=f,t[22]=h,t[23]=k,t[24]=m,t[25]=o,t[26]=c,t[27]=s,t[28]=j,t[29]=M,t[30]=N,t[31]=P,t[32]=F,t[33]=I,t[34]=L,t[35]=U,t[36]=G,t[37]=te,t[38]=K,t[39]=q,t[40]=J,t[41]=ne,t[42]=re,t[43]=ie,t[44]=ae,t[45]=oe,t[46]=se,t[47]=ce,t[48]=le}else j=t[28],M=t[29],N=t[30],P=t[31],F=t[32],I=t[33],L=t[34],U=t[35],G=t[36],te=t[37],K=t[38],q=t[39],J=t[40],ne=t[41],re=t[42],ie=t[43],ae=t[44],oe=t[45],se=t[46],ce=t[47],le=t[48];let ue;t[157]!==j||t[158]!==ie||t[159]!==ae||t[160]!==oe?(ue=(0,$.jsx)(j,{id:ie,className:ae,children:oe}),t[157]=j,t[158]=ie,t[159]=ae,t[160]=oe,t[161]=ue):ue=t[161];let Y;t[162]===x?Y=t[163]:(Y=x?(0,$.jsx)(Vr,{id:`create-saved-theme-error`,children:x}):null,t[162]=x,t[163]=Y);let de;t[164]!==M||t[165]!==ue||t[166]!==Y||t[167]!==se||t[168]!==ce||t[169]!==le?(de=(0,$.jsxs)(M,{"data-invalid":se,children:[ce,le,ue,Y]}),t[164]=M,t[165]=ue,t[166]=Y,t[167]=se,t[168]=ce,t[169]=le,t[170]=de):de=t[170];let fe;t[171]!==I||t[172]!==L||t[173]!==U||t[174]!==de?(fe=(0,$.jsx)(`form`,{id:I,noValidate:L,onSubmit:U,children:de}),t[171]=I,t[172]=L,t[173]=U,t[174]=de,t[175]=fe):fe=t[175];let pe;t[176]!==N||t[177]!==fe?(pe=(0,$.jsx)(N,{children:fe}),t[176]=N,t[177]=fe,t[178]=pe):pe=t[178];let me;t[179]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>v(!1),t[179]=me):me=t[179];let he;t[180]===a?he=t[181]:(he=a({id:`dEgA5A`}),t[180]=a,t[181]=he);let ge;t[182]!==C||t[183]!==he?(ge=(0,$.jsx)(A,{type:`button`,variant:`outline`,disabled:C,onClick:me,children:he}),t[182]=C,t[183]=he,t[184]=ge):ge=t[184];let _e;t[185]!==a||t[186]!==C?(_e=a(C?{id:`_DwR-n`}:{id:`cuHhjo`}),t[185]=a,t[186]=C,t[187]=_e):_e=t[187];let ve;t[188]!==C||t[189]!==_e?(ve=(0,$.jsx)(A,{type:`submit`,form:`create-saved-theme-form`,disabled:C,children:_e}),t[188]=C,t[189]=_e,t[190]=ve):ve=t[190];let ye;t[191]!==ge||t[192]!==ve?(ye=(0,$.jsxs)(H,{children:[ge,ve]}),t[191]=ge,t[192]=ve,t[193]=ye):ye=t[193];let be;t[194]!==P||t[195]!==G||t[196]!==pe||t[197]!==ye?(be=(0,$.jsxs)(P,{children:[G,pe,ye]}),t[194]=P,t[195]=G,t[196]=pe,t[197]=ye,t[198]=be):be=t[198];let xe;t[199]!==F||t[200]!==te||t[201]!==K||t[202]!==be?(xe=(0,$.jsx)(F,{open:te,onOpenChange:K,children:be}),t[199]=F,t[200]=te,t[201]=K,t[202]=be,t[203]=xe):xe=t[203];let Se;return t[204]!==q||t[205]!==J||t[206]!==ne||t[207]!==re||t[208]!==xe?(Se=(0,$.jsxs)(`div`,{className:q,children:[J,ne,re,xe]}),t[204]=q,t[205]=J,t[206]=ne,t[207]=re,t[208]=xe,t[209]=Se):Se=t[209],Se}function Sa(e){return e.id}function Ca(e){return e.id}function wa(e){return e.id.startsWith(`saved-`)}function Ta(e){let t=et(e.id);return!t.ok||!e.scheme?[]:[{id:e.id,stem:t.stem,label:e.label,scheme:e.scheme}]}function Ea(e){return e.id!==`custom`}function Da(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)]:Da(r,t)}}function Oa(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 ka(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 Aa(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 ja(e){let t=(0,Q.c)(14),n;t[0]===e?n=t[1]:(n=e.current(),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i={defaultValues:r,mode:`onBlur`},t[2]=r,t[3]=i);let a=hi(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{Ma(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,Z.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>Na(a,e,t),t[8]=e,t[9]=a,t[10]=c):c=t[10];let l=c,u;return t[11]!==l||t[12]!==a?(u={form:a,commitField:l},t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function Ma(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function Na(e,t,n){let r=e.getValues(n),i=Da(Ia(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(We(a.error)&&a.error.code===`SCHEMA_INVALID`&&a.error.issues.length>0){e.clearErrors(n);for(let t of a.error.issues){let r=t.path.length>0?t.path.map(String).join(`.`):n;e.setError(r,{type:`config-binding`,message:t.message})}}else e.setError(n,{type:`config-binding`,message:Pa(a.error,n)});return!1}function Pa(e,t){if(We(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>Fa(e,t));if(n)return n.message}return tt(e)}function Fa(e,t){return e.path.map(String).join(`.`)===t}function Ia(e){return e.split(`.`)}function La(e){if(!We(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 Ra(){let e=(0,Q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(qr,{className:`h-5 w-32`}),n=(0,$.jsx)(qr,{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)(qr,{className:`h-9 w-full`}),(0,$.jsx)(qr,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function za({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=_(),a=yi(),{setTheme:o}=y(),s=Jt(),c=nt(Dt,e.path),l=c?ka(c):void 0,u=c?Oa(c):void 0,d=c?Aa(c):void 0,f=c?jt(c):void 0,p=f?.scope===`project`&&t!==`project`||f?.scope===`user`&&t!==`user`,m=e.path.join(`.`),h=i(e.label),[v,b]=(0,Z.useState)(!1),x=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);let C=()=>{b(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>b(!1),1200)},w=()=>{let e=n(m);return e&&C(),e},T=()=>a.getFieldState(m).isDirty?w():!0,E=()=>{if(e.control===`theme-tiles`){let e=s?.userBinding;if(!e)return;let t=e.patch({appearance:Pr()});t.ok?C():a.setError(m,{type:`manual`,message:Pa(t.error,m)});return}let t=u===void 0?null:u;a.setValue(m,t,{shouldDirty:!1}),e.control===`theme-cards`&&o(Xt(t)),w()},D=S(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(gi,{control:a.control,name:m,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(mi,{className:D,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(vi,{className:`text-sm font-medium`,children:h}),r?(0,$.jsxs)(P,{children:[(0,$.jsx)(j,{asChild:!0,children:(0,$.jsx)(A,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:E,"aria-label":i({id:`lhjq3G`,values:{labelText:h}}),children:(0,$.jsx)(xe,{className:`size-3.5`})})}),(0,$.jsx)(M,{children:(0,$.jsx)(g,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(bi,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(_i,{children:(0,$.jsx)(Va,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:T,onRevertToBaseline:()=>a.resetField(m,{keepError:!0}),onSavedOutsideForm:C,onWriteRejected:e=>{a.setError(m,{type:`manual`,message:Pa(e,m)})}})}),(0,$.jsx)(Ga,{visible:v,srOnly:Ba(e.control)})]}),(0,$.jsx)(xi,{"data-field-error":e.path.join(`.`)})]})}})}function Ba(e){return e===`theme-tiles`||e===`theme-cards`}function Va({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,onRevertToBaseline:a,onSavedOutsideForm:o,onWriteRejected:s,...c}){"use no memo";let{_:l}=_(),{setTheme:u,systemTheme:d}=y(),f=Jt(),p=f?.merged??null;if(e.control===`language-select`)return(0,$.jsx)(ua,{...c,value:t.value,ref:t.ref,onBlur:t.onBlur,onValueChange:e=>{let n=br(t.value)??`system`;n!==e&&ta({from:n,to:e}),t.onChange(e),i()}});if(e.control===`theme-cards`){let{id:n,...r}=c;return(0,$.jsx)(fr,{...r,firstItemId:n,value:Xt(t.value),"aria-label":l(e.label),onValueChange:e=>{let n=Xt(t.value);u(e),t.onChange(e),!i()&&(u(n),a())}})}if(e.control===`theme-tiles`){let{id:t,...n}=c,r=p?.appearance?.customTheme,i=p?.appearance?.theme,a=Je(i,d===`dark`);return(0,$.jsx)(xa,{...n,firstItemId:t,appearance:p?.appearance,customSeed:r,slotMode:a,"aria-label":l(e.label),onAssign:(e,t,n,c)=>{let l=f?.userBinding;if(!l)return;let d={...n,[e]:t},p=e=>{let t=e[a];return t===`custom`?Or(Fr(r)):Dr(t,c)};Nr({selection:d,modePreference:i,slotMode:a,customSeed:r,themes:c});let m=p(d);m&&u(m);let h=l.patch({appearance:Ir(d)});if(h.ok){ia(d),o();return}Nr({selection:n,modePreference:i,slotMode:a,customSeed:r,themes:c}),u(p(n)??i??`system`),s(h.error)}})}if(n===`boolean`)return(0,$.jsx)(Se,{...c,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,...a}=c;return(0,$.jsx)(Te,{...a,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{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":l(e.label),children:r.map((e,t)=>(0,$.jsx)(Ce,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Ua,{ctl:t,onCommit:i,...c}):n===`array`?(0,$.jsx)(Wa,{ctl:t,onCommit:i,...c}):(0,$.jsx)(Ha,{ctl:t,onCommit:i,...c})}function Ha({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Cr,{...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 Ua({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Z.useState)(e.value===void 0?``:String(e.value)),a=(0,Z.useRef)(e.value);(0,Z.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)(Cr,{...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 Wa({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
2
2
  `):``,[i,a]=(0,Z.useState)(r),o=(0,Z.useRef)(r);(0,Z.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-Cym3gapE.js";import{a as ee,c as te,i as s,n as ne,o as re,s as ie,t as ae}from"./dialog-CTNat3T_.js";import{n as c}from"./dist-CJhtNlOm2.js";import{t as l}from"./desktop-bridge-types-oYPdTDmz.js";import{n as u,t as oe}from"./git-branch-3CSRgL0o.js";import{t as d}from"./spinner-t7GahFcQ.js";import{n as se,t as f}from"./miss-dialog-store-DVpIaq34.js";import{r as p,t as m}from"./auth-prompt-store-3WR-Jv7J.js";import{a as h,n as g}from"./receive-store-D7nvngvO.js";import{t as ce}from"./share-metadata-rows-DPgPU-ev.js";var _=e(n(),1),le=a();function ue(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function v(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ge(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function _e(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ve(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function ye(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=v(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function be(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var y=t();function xe(e){return l(e.repositoryTarget)}function Se(e,t=l(e.target)){let n=e.contentRootDepth===null?t:[...xe(e).split(`/`).slice(0,e.contentRootDepth),...t===``?[]:t.split(`/`)].join(`/`);return{kind:e.target.kind,path:t,repositoryPath:n,...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function Ce(e){return e!==null&&e.kind===`project-branch-switch`}function b(e){let t=(0,le.c)(217),{bridge:n,store:a}=e,m=a===void 0?g:a,{_:v}=i(),b=(0,_.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[x,S]=(0,_.useState)(fe),Me=(0,_.useRef)(!1),Ne=(0,_.useRef)(!1),Pe=(0,_.useRef)(!1),Fe=(0,_.useRef)(null),Ie;t[0]===b?Ie=t[1]:(Ie=Ce(b)?b:null,t[0]=b,t[1]=Ie);let C=Ie,Le;t[2]!==v||t[3]!==C?.share.target.kind?(Le=C?.share.target.kind===`folder`?v({id:`ugoTXs`}):v({id:`XH30C4`}),t[2]=v,t[3]=C?.share.target.kind,t[4]=Le):Le=t[4];let w=Le,Re;t[5]===C?Re=t[6]:(Re=()=>{S(fe),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=C},t[5]=C,t[6]=Re);let ze;t[7]===b?ze=t[8]:(ze=[b],t[7]=b,t[8]=ze),(0,_.useEffect)(Re,ze);let Be;t[9]!==C||t[10]!==n?(Be=()=>{if(!C||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.repositoryTarget.kind,path:xe(C.share)}).then(t=>{e||S(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),S(Ae))}),()=>{e=!0}},t[9]=C,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===C?Ve=t[13]:(Ve=[C],t[12]=C,t[13]=Ve),(0,_.useEffect)(Be,Ve);let He;t[14]!==C||t[15]!==x.info||t[16]!==x.phase||t[17]!==n?(He=()=>{if(!C||x.phase!==`ready`||Pe.current||!ge(x.info))return;Pe.current=!0,S(_e);let e=C;n.project.fetchTargetStatus({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.target.kind,path:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth}}).then(t=>{Fe.current===e&&S(e=>ve(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),S(ke))})},t[14]=C,t[15]=x.info,t[16]=x.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==C||t[20]!==x.phase?(Ue=[x.phase,C],t[19]=C,t[20]=x.phase,t[21]=Ue):Ue=t[21],(0,_.useEffect)(He,Ue);let We;t[22]!==C||t[23]!==x.phase||t[24]!==x.resolution||t[25]!==m?(We=()=>{if(x.phase!==`verdict`)return;let{kind:e}=x.resolution;e!==`deleted`&&e!==`never-on-branch`||C&&(f.arm({kind:C.share.target.kind,path:l(C.share.target),repositoryPath:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth},branch:C.share.branch}),m.dismiss())},t[22]=C,t[23]=x.phase,t[24]=x.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==C||t[28]!==x||t[29]!==m?(Ge=[x,C,m],t[27]=C,t[28]=x,t[29]=m,t[30]=Ge):Ge=t[30],(0,_.useEffect)(We,Ge);let Ke;t[31]!==x.phase||t[32]!==x.resolution?(Ke=()=>{x.phase===`verdict`&&console.log(h({verdict_cell:x.resolution.kind}))},t[31]=x.phase,t[32]=x.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===x?qe=t[35]:(qe=[x],t[34]=x,t[35]=qe),(0,_.useEffect)(Ke,qe);let Je;t[36]!==v||t[37]!==C||t[38]!==x.pendingDoc||t[39]!==x.phase||t[40]!==n||t[41]!==m||t[42]!==w?(Je=()=>{if(x.phase!==`awaiting-cc1-recycle`||!C)return;let e=C.share.branch,t=x.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:C.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(h({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:C.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(C.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),c.error(v({id:`gQV-9w`,values:{targetNoun:w}}))}),m.dismiss();return}console.log(h({branch_dialog_action:`branch-switch-timeout`,branch:e})),c.error(v({id:`LBwUR6`,values:{targetNoun:w}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),c.error(v({id:`Jw6EC4`,values:{targetNoun:w}})),m.dismiss())}),()=>{r=!0}},t[36]=v,t[37]=C,t[38]=x.pendingDoc,t[39]=x.phase,t[40]=n,t[41]=m,t[42]=w,t[43]=Je):Je=t[43];let Ye;if(t[44]!==C||t[45]!==x.phase?(Ye=[x.phase,C],t[44]=C,t[45]=x.phase,t[46]=Ye):Ye=t[46],(0,_.useEffect)(Je,Ye),!C)return null;let{share:T,projectPath:E,currentBranch:Xe}=C,D=T.branch,Ze;t[47]!==v||t[48]!==n.project||t[49]!==E||t[50]!==D||t[51]!==m?(Ze=function(e,t,r){console.log(h({branch_dialog_action:`switch`,branch_action:`switch`,branch:D,verdict_cell:r})),S(t=>me(t,e)),n.project.runCheckout(t?{projectPath:E,branch:D,fastForward:!0}:{projectPath:E,branch:D}).then(e=>{let t=null,n=!1;S(r=>{let{state:i,sideEffect:a}=ye(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?c.error(v({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?c.error(v({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&c.error(v({id:`c863eW`,values:{shareBranch:D}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),S(Oe),c.error(v({id:`c863eW`,values:{shareBranch:D}}))})},t[47]=v,t[48]=n.project,t[49]=E,t[50]=D,t[51]=m,t[52]=Ze):Ze=t[52];let O=Ze,Qe;t[53]!==x.info||t[54]!==x.phase||t[55]!==O||t[56]!==T.target?(Qe=function(){x.phase===`ready`&&ue(x.info).switchEnabled&&O(l(T.target),!1)},t[53]=x.info,t[54]=x.phase,t[55]=O,t[56]=T.target,t[57]=Qe):Qe=t[57];let $e=Qe,et;t[58]!==x.phase||t[59]!==x.resolution||t[60]!==O||t[61]!==T.target?(et=function(){x.phase===`verdict`&&O(l(T.target),!0,x.resolution.kind)},t[58]=x.phase,t[59]=x.resolution,t[60]=O,t[61]=T.target,t[62]=et):et=t[62];let tt=et,nt;t[63]!==x.phase||t[64]!==x.resolution||t[65]!==O?(nt=function(){x.phase===`verdict`&&x.resolution.kind===`renamed`&&O(x.resolution.renamedTo,!0,x.resolution.kind)},t[63]=x.phase,t[64]=x.resolution,t[65]=O,t[66]=nt):nt=t[66];let rt=nt,it;t[67]!==x.phase||t[68]!==x.resolution||t[69]!==O||t[70]!==T.target?(it=function(){x.phase===`verdict`&&O(l(T.target),!1,x.resolution.kind)},t[67]=x.phase,t[68]=x.resolution,t[69]=O,t[70]=T.target,t[71]=it):it=t[71];let at=it,ot;t[72]!==v||t[73]!==n.project||t[74]!==E||t[75]!==T||t[76]!==D||t[77]!==m||t[78]!==w?(ot=function(){console.log(h({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),c.error(v({id:`b5aNbi`,values:{targetNoun:w}}))}),m.dismiss()},t[72]=v,t[73]=n.project,t[74]=E,t[75]=T,t[76]=D,t[77]=m,t[78]=w,t[79]=ot):ot=t[79];let st=ot,ct;t[80]!==v||t[81]!==D?(ct=function(e,t){let{helper:n,authFailed:r,notFoundAsIdentity:i}=t===void 0?{}:t;if(e===`fetch-failed`&&i){c.error(v({id:`jRsjlF`}));return}if(e===`fetch-failed`&&r){c.error(v({id:`gfb-CM`}),{action:{label:v({id:`5lWFkC`}),onClick:De}});return}switch(e){case`helper-not-found`:{let e=n??v({id:`cHhH3i`});c.error(v({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:c.error(v({id:`NJyQi_`,values:{shareBranch:D}}));return;case`fetch-failed`:c.error(v({id:`bWLmRK`}));return;case`already-checked-out`:c.error(v({id:`ljHjfg`}));return;case`branch-exists`:c.error(v({id:`h3QZcB`,values:{shareBranch:D}}));return;case`path-exists`:c.error(v({id:`cN1Gcp`,values:{shareBranch:D}}));return;case`no-git`:c.error(v({id:`CFnavk`}));return;case`empty-repo`:c.error(v({id:`5IgYAM`}));return;case`invalid-branch`:c.error(v({id:`JfPuv7`,values:{shareBranch:D}}));return;case`proxy-null`:case`error`:c.error(v({id:`e8zYa8`,values:{shareBranch:D}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=v,t[81]=D,t[82]=ct):ct=t[82];let lt=ct,ut;t[83]!==v||t[84]!==n.project||t[85]!==T||t[86]!==D||t[87]!==lt||t[88]!==m?(ut=function(e){let t=null,r,i,a,o=!1,ee=null;if(S(n=>{let{state:te,sideEffect:s}=be(n,e);return s&&(t=s.reason,r=s.helper,i=s.authFailed,a=s.notFoundAsIdentity,o=te.phase===`dismissed`),te.phase===`opening-worktree`&&(ee=te.path),te}),t!==null&&(console.log(h({branch_dialog_action:`open-worktree-failed:${t}`,branch:D})),lt(t,{helper:r,authFailed:i,notFoundAsIdentity:a})),ee!==null){p();let e=ee;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),c.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}o&&m.dismiss()},t[83]=v,t[84]=n.project,t[85]=T,t[86]=D,t[87]=lt,t[88]=m,t[89]=ut):ut=t[89];let dt=ut,ft;t[90]!==dt||t[91]!==x.phase||t[92]!==n.worktree||t[93]!==D?(ft=function(){x.phase===`ready`&&(console.log(h({branch_dialog_action:`open-worktree`,branch:D})),S(he),n.worktree.checkout({branch:D}).then(e=>{dt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),dt(null)}))},t[90]=dt,t[91]=x.phase,t[92]=n.worktree,t[93]=D,t[94]=ft):ft=t[94];let pt=ft,mt;t[95]!==v||t[96]!==x.otherWorktreePath||t[97]!==x.phase||t[98]!==n.project||t[99]!==T||t[100]!==D||t[101]!==m?(mt=function(){if(x.phase!==`branch-in-other-worktree`)return;let e=x.otherWorktreePath;console.log(h({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),c.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=v,t[96]=x.otherWorktreePath,t[97]=x.phase,t[98]=n.project,t[99]=T,t[100]=D,t[101]=m,t[102]=mt):mt=t[102];let ht=mt,gt;t[103]!==x.phase||t[104]!==x.resolution||t[105]!==m?(gt=function(){console.log(h({branch_dialog_action:`cancel`,verdict_cell:x.phase===`verdict`?x.resolution.kind:void 0})),m.dismiss()},t[103]=x.phase,t[104]=x.resolution,t[105]=m,t[106]=gt):gt=t[106];let k=gt,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J;if(t[107]!==v||t[108]!==x.info||t[109]!==x.otherWorktreePath||t[110]!==x.phase||t[111]!==x.resolution||t[112]!==k||t[113]!==Xe||t[114]!==T.branch||t[115]!==T.owner||t[116]!==T.repo||t[117]!==T.target||t[118]!==D||t[119]!==w){q=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?ue(x.info):null;let e;t[139]!==x.info||t[140]!==x.phase||t[141]!==Xe?(e=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?de(x.info):Xe??`HEAD`,t[139]=x.info,t[140]=x.phase,t[141]=Xe,t[142]=e):e=t[142];let n=e;I=x.phase===`switching`||x.phase===`awaiting-cc1-recycle`,N=x.phase===`creating-worktree`;let i;t[143]===v?i=t[144]:(i=v({id:`OuY8t9`}),t[143]=v,t[144]=i),P=i;let a;t[145]===v?a=t[146]:(a=v({id:`XZkdtg`}),t[145]=v,t[146]=a),F=a;let o;t[147]===v?o=t[148]:(o=v({id:`VTulZj`}),t[147]=v,t[148]=o),J=o;let re=x.phase===`loading`,c=x.phase===`error`;M=ae,G=!0,t[149]===k?K=t[150]:(K=e=>{e||k()},t[149]=k,t[150]=K),j=s,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Ee,U=Te;let u;t[151]===w?u=t[152]:(u=(0,y.jsx)(te,{children:(0,y.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:w}})}),t[151]=w,t[152]=u);let oe=T.owner,se=T.repo,f;t[153]===T.target?f=t[154]:(f=l(T.target),t[153]=T.target,t[154]=f);let p;t[155]!==T.owner||t[156]!==T.repo||t[157]!==f?(p=(0,y.jsx)(ee,{className:`sr-only`,children:(0,y.jsx)(r,{id:`f8jU-L`,values:{0:oe,1:se,2:f}})}),t[155]=T.owner,t[156]=T.repo,t[157]=f,t[158]=p):p=t[158],t[159]!==u||t[160]!==p?(W=(0,y.jsxs)(ie,{children:[u,p]}),t[159]=u,t[160]=p,t[161]=W):W=t[161],A=ne;let m=T.owner,h=T.repo,g;t[162]===T.target?g=t[163]:(g=l(T.target),t[162]=T.target,t[163]=g),t[164]!==T.branch||t[165]!==T.owner||t[166]!==T.repo||t[167]!==T.target.kind||t[168]!==g?(L=(0,y.jsx)(`div`,{className:`mb-4`,children:(0,y.jsx)(ce,{owner:m,repo:h,path:g,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=T.branch,t[165]=T.owner,t[166]=T.repo,t[167]=T.target.kind,t[168]=g,t[169]=L):L=t[169],R=x.phase===`branch-in-other-worktree`?(0,y.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,y.jsx)(`p`,{className:`leading-6`,children:(0,y.jsx)(r,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,y.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:x.otherWorktreePath})]}):x.phase===`verdict-pending`?(0,y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,y.jsx)(r,{id:`Uay5NL`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`renamed`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,y.jsx)(r,{id:`P0HC30`,values:{0:x.resolution.renamedTo,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`diverged`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,y.jsx)(r,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):re?(0,y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`jerqF0`})]}):c?(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,y.jsx)(r,{id:`w4hMYl`})}):q?.kind===`D`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`DTI-fp`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`_902BE`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,y.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,y.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,y.jsx)(r,{id:`n2lRue`})}),(0,y.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(we)})]}):null,t[107]=v,t[108]=x.info,t[109]=x.otherWorktreePath,t[110]=x.phase,t[111]=x.resolution,t[112]=k,t[113]=Xe,t[114]=T.branch,t[115]=T.owner,t[116]=T.repo,t[117]=T.target,t[118]=D,t[119]=w,t[120]=A,t[121]=j,t[122]=M,t[123]=N,t[124]=P,t[125]=F,t[126]=I,t[127]=L,t[128]=R,t[129]=z,t[130]=B,t[131]=V,t[132]=H,t[133]=U,t[134]=W,t[135]=G,t[136]=K,t[137]=q,t[138]=J}else A=t[120],j=t[121],M=t[122],N=t[123],P=t[124],F=t[125],I=t[126],L=t[127],R=t[128],z=t[129],B=t[130],V=t[131],H=t[132],U=t[133],W=t[134],G=t[135],K=t[136],q=t[137],J=t[138];let Y;t[170]===I?Y=t[171]:(Y=I?(0,y.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=I,t[171]=Y);let X;t[172]===N?X=t[173]:(X=N?(0,y.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=N,t[173]=X);let Z;t[174]!==A||t[175]!==L||t[176]!==R||t[177]!==z||t[178]!==Y||t[179]!==X?(Z=(0,y.jsxs)(A,{children:[L,R,z,Y,X]}),t[174]=A,t[175]=L,t[176]=R,t[177]=z,t[178]=Y,t[179]=X,t[180]=Z):Z=t[180];let _t;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,y.jsx)(r,{id:`dEgA5A`}),t[181]=_t):_t=t[181];let Q;t[182]===k?Q=t[183]:(Q=(0,y.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:k,"data-testid":`share-branch-switch-cancel`,children:_t}),t[182]=k,t[183]=Q);let vt;t[184]!==x.phase||t[185]!==x.resolution||t[186]!==N||t[187]!==st||t[188]!==rt||t[189]!==pt||t[190]!==ht||t[191]!==at||t[192]!==$e||t[193]!==tt||t[194]!==P||t[195]!==F||t[196]!==I||t[197]!==q||t[198]!==J?(vt=x.phase===`branch-in-other-worktree`?(0,y.jsx)(o,{onClick:ht,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,y.jsx)(r,{id:`hyCxJY`})}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsxs)(o,{onClick:tt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`uA_jXp`})]}):x.resolution.kind===`renamed`?(0,y.jsxs)(o,{onClick:rt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`AItsE5`})]}):x.resolution.kind===`diverged`?(0,y.jsxs)(o,{onClick:at,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,y.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[q?.openCurrentEnabled?(0,y.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:st,disabled:I||N,"data-testid":`share-branch-switch-open-current`,children:[(0,y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,y.jsx)(o,{variant:`outline`,onClick:$e,disabled:!q?.switchEnabled||I||N,"aria-disabled":!q?.switchEnabled||I||N,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),F]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),F]})}),(0,y.jsx)(o,{onClick:pt,disabled:!q||I||N,"data-testid":`share-branch-switch-worktree`,children:N?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),J]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),J]})})]}),t[184]=x.phase,t[185]=x.resolution,t[186]=N,t[187]=st,t[188]=rt,t[189]=pt,t[190]=ht,t[191]=at,t[192]=$e,t[193]=tt,t[194]=P,t[195]=F,t[196]=I,t[197]=q,t[198]=J,t[199]=vt):vt=t[199];let yt;t[200]!==Q||t[201]!==vt?(yt=(0,y.jsxs)(re,{className:`sm:justify-between`,children:[Q,vt]}),t[200]=Q,t[201]=vt,t[202]=yt):yt=t[202];let $;t[203]!==j||t[204]!==B||t[205]!==V||t[206]!==H||t[207]!==U||t[208]!==W||t[209]!==Z||t[210]!==yt?($=(0,y.jsxs)(j,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Z,yt]}),t[203]=j,t[204]=B,t[205]=V,t[206]=H,t[207]=U,t[208]=W,t[209]=Z,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==M||t[213]!==G||t[214]!==K||t[215]!==$?(bt=(0,y.jsx)(M,{open:G,onOpenChange:K,children:$}),t[212]=M,t[213]=G,t[214]=K,t[215]=$,t[216]=bt):bt=t[216],bt}function we(e){return(0,y.jsx)(`li`,{children:(0,y.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Te(e){e.preventDefault()}function Ee(e){e.preventDefault()}function De(){return m.request()}function Oe(e){return ye(e,null).state}function ke(e){return ve(e,null)}function Ae(e){return pe(e,null)}function je(){return null}export{b as ShareBranchSwitchDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-Cym3gapE.js";import{a as ee,c as te,i as s,n as ne,o as re,s as ie,t as ae}from"./dialog-CTNat3T_.js";import{n as c}from"./dist-CJhtNlOm2.js";import{t as l}from"./desktop-bridge-types-oYPdTDmz.js";import{n as u,t as oe}from"./git-branch-3CSRgL0o.js";import{t as d}from"./spinner-t7GahFcQ.js";import{n as se,t as f}from"./miss-dialog-store-DVpIaq34.js";import{r as p,t as m}from"./auth-prompt-store-3WR-Jv7J.js";import{a as h,n as g}from"./receive-store-DMcyiDfj.js";import{t as ce}from"./share-metadata-rows-DPgPU-ev.js";var _=e(n(),1),le=a();function ue(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function v(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ge(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function _e(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ve(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function ye(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=v(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function be(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var y=t();function xe(e){return l(e.repositoryTarget)}function Se(e,t=l(e.target)){let n=e.contentRootDepth===null?t:[...xe(e).split(`/`).slice(0,e.contentRootDepth),...t===``?[]:t.split(`/`)].join(`/`);return{kind:e.target.kind,path:t,repositoryPath:n,...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function Ce(e){return e!==null&&e.kind===`project-branch-switch`}function b(e){let t=(0,le.c)(217),{bridge:n,store:a}=e,m=a===void 0?g:a,{_:v}=i(),b=(0,_.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[x,S]=(0,_.useState)(fe),Me=(0,_.useRef)(!1),Ne=(0,_.useRef)(!1),Pe=(0,_.useRef)(!1),Fe=(0,_.useRef)(null),Ie;t[0]===b?Ie=t[1]:(Ie=Ce(b)?b:null,t[0]=b,t[1]=Ie);let C=Ie,Le;t[2]!==v||t[3]!==C?.share.target.kind?(Le=C?.share.target.kind===`folder`?v({id:`ugoTXs`}):v({id:`XH30C4`}),t[2]=v,t[3]=C?.share.target.kind,t[4]=Le):Le=t[4];let w=Le,Re;t[5]===C?Re=t[6]:(Re=()=>{S(fe),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=C},t[5]=C,t[6]=Re);let ze;t[7]===b?ze=t[8]:(ze=[b],t[7]=b,t[8]=ze),(0,_.useEffect)(Re,ze);let Be;t[9]!==C||t[10]!==n?(Be=()=>{if(!C||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.repositoryTarget.kind,path:xe(C.share)}).then(t=>{e||S(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),S(Ae))}),()=>{e=!0}},t[9]=C,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===C?Ve=t[13]:(Ve=[C],t[12]=C,t[13]=Ve),(0,_.useEffect)(Be,Ve);let He;t[14]!==C||t[15]!==x.info||t[16]!==x.phase||t[17]!==n?(He=()=>{if(!C||x.phase!==`ready`||Pe.current||!ge(x.info))return;Pe.current=!0,S(_e);let e=C;n.project.fetchTargetStatus({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.target.kind,path:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth}}).then(t=>{Fe.current===e&&S(e=>ve(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),S(ke))})},t[14]=C,t[15]=x.info,t[16]=x.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==C||t[20]!==x.phase?(Ue=[x.phase,C],t[19]=C,t[20]=x.phase,t[21]=Ue):Ue=t[21],(0,_.useEffect)(He,Ue);let We;t[22]!==C||t[23]!==x.phase||t[24]!==x.resolution||t[25]!==m?(We=()=>{if(x.phase!==`verdict`)return;let{kind:e}=x.resolution;e!==`deleted`&&e!==`never-on-branch`||C&&(f.arm({kind:C.share.target.kind,path:l(C.share.target),repositoryPath:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth},branch:C.share.branch}),m.dismiss())},t[22]=C,t[23]=x.phase,t[24]=x.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==C||t[28]!==x||t[29]!==m?(Ge=[x,C,m],t[27]=C,t[28]=x,t[29]=m,t[30]=Ge):Ge=t[30],(0,_.useEffect)(We,Ge);let Ke;t[31]!==x.phase||t[32]!==x.resolution?(Ke=()=>{x.phase===`verdict`&&console.log(h({verdict_cell:x.resolution.kind}))},t[31]=x.phase,t[32]=x.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===x?qe=t[35]:(qe=[x],t[34]=x,t[35]=qe),(0,_.useEffect)(Ke,qe);let Je;t[36]!==v||t[37]!==C||t[38]!==x.pendingDoc||t[39]!==x.phase||t[40]!==n||t[41]!==m||t[42]!==w?(Je=()=>{if(x.phase!==`awaiting-cc1-recycle`||!C)return;let e=C.share.branch,t=x.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:C.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(h({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:C.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(C.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),c.error(v({id:`gQV-9w`,values:{targetNoun:w}}))}),m.dismiss();return}console.log(h({branch_dialog_action:`branch-switch-timeout`,branch:e})),c.error(v({id:`LBwUR6`,values:{targetNoun:w}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),c.error(v({id:`Jw6EC4`,values:{targetNoun:w}})),m.dismiss())}),()=>{r=!0}},t[36]=v,t[37]=C,t[38]=x.pendingDoc,t[39]=x.phase,t[40]=n,t[41]=m,t[42]=w,t[43]=Je):Je=t[43];let Ye;if(t[44]!==C||t[45]!==x.phase?(Ye=[x.phase,C],t[44]=C,t[45]=x.phase,t[46]=Ye):Ye=t[46],(0,_.useEffect)(Je,Ye),!C)return null;let{share:T,projectPath:E,currentBranch:Xe}=C,D=T.branch,Ze;t[47]!==v||t[48]!==n.project||t[49]!==E||t[50]!==D||t[51]!==m?(Ze=function(e,t,r){console.log(h({branch_dialog_action:`switch`,branch_action:`switch`,branch:D,verdict_cell:r})),S(t=>me(t,e)),n.project.runCheckout(t?{projectPath:E,branch:D,fastForward:!0}:{projectPath:E,branch:D}).then(e=>{let t=null,n=!1;S(r=>{let{state:i,sideEffect:a}=ye(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?c.error(v({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?c.error(v({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&c.error(v({id:`c863eW`,values:{shareBranch:D}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),S(Oe),c.error(v({id:`c863eW`,values:{shareBranch:D}}))})},t[47]=v,t[48]=n.project,t[49]=E,t[50]=D,t[51]=m,t[52]=Ze):Ze=t[52];let O=Ze,Qe;t[53]!==x.info||t[54]!==x.phase||t[55]!==O||t[56]!==T.target?(Qe=function(){x.phase===`ready`&&ue(x.info).switchEnabled&&O(l(T.target),!1)},t[53]=x.info,t[54]=x.phase,t[55]=O,t[56]=T.target,t[57]=Qe):Qe=t[57];let $e=Qe,et;t[58]!==x.phase||t[59]!==x.resolution||t[60]!==O||t[61]!==T.target?(et=function(){x.phase===`verdict`&&O(l(T.target),!0,x.resolution.kind)},t[58]=x.phase,t[59]=x.resolution,t[60]=O,t[61]=T.target,t[62]=et):et=t[62];let tt=et,nt;t[63]!==x.phase||t[64]!==x.resolution||t[65]!==O?(nt=function(){x.phase===`verdict`&&x.resolution.kind===`renamed`&&O(x.resolution.renamedTo,!0,x.resolution.kind)},t[63]=x.phase,t[64]=x.resolution,t[65]=O,t[66]=nt):nt=t[66];let rt=nt,it;t[67]!==x.phase||t[68]!==x.resolution||t[69]!==O||t[70]!==T.target?(it=function(){x.phase===`verdict`&&O(l(T.target),!1,x.resolution.kind)},t[67]=x.phase,t[68]=x.resolution,t[69]=O,t[70]=T.target,t[71]=it):it=t[71];let at=it,ot;t[72]!==v||t[73]!==n.project||t[74]!==E||t[75]!==T||t[76]!==D||t[77]!==m||t[78]!==w?(ot=function(){console.log(h({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),c.error(v({id:`b5aNbi`,values:{targetNoun:w}}))}),m.dismiss()},t[72]=v,t[73]=n.project,t[74]=E,t[75]=T,t[76]=D,t[77]=m,t[78]=w,t[79]=ot):ot=t[79];let st=ot,ct;t[80]!==v||t[81]!==D?(ct=function(e,t){let{helper:n,authFailed:r,notFoundAsIdentity:i}=t===void 0?{}:t;if(e===`fetch-failed`&&i){c.error(v({id:`jRsjlF`}));return}if(e===`fetch-failed`&&r){c.error(v({id:`gfb-CM`}),{action:{label:v({id:`5lWFkC`}),onClick:De}});return}switch(e){case`helper-not-found`:{let e=n??v({id:`cHhH3i`});c.error(v({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:c.error(v({id:`NJyQi_`,values:{shareBranch:D}}));return;case`fetch-failed`:c.error(v({id:`bWLmRK`}));return;case`already-checked-out`:c.error(v({id:`ljHjfg`}));return;case`branch-exists`:c.error(v({id:`h3QZcB`,values:{shareBranch:D}}));return;case`path-exists`:c.error(v({id:`cN1Gcp`,values:{shareBranch:D}}));return;case`no-git`:c.error(v({id:`CFnavk`}));return;case`empty-repo`:c.error(v({id:`5IgYAM`}));return;case`invalid-branch`:c.error(v({id:`JfPuv7`,values:{shareBranch:D}}));return;case`proxy-null`:case`error`:c.error(v({id:`e8zYa8`,values:{shareBranch:D}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=v,t[81]=D,t[82]=ct):ct=t[82];let lt=ct,ut;t[83]!==v||t[84]!==n.project||t[85]!==T||t[86]!==D||t[87]!==lt||t[88]!==m?(ut=function(e){let t=null,r,i,a,o=!1,ee=null;if(S(n=>{let{state:te,sideEffect:s}=be(n,e);return s&&(t=s.reason,r=s.helper,i=s.authFailed,a=s.notFoundAsIdentity,o=te.phase===`dismissed`),te.phase===`opening-worktree`&&(ee=te.path),te}),t!==null&&(console.log(h({branch_dialog_action:`open-worktree-failed:${t}`,branch:D})),lt(t,{helper:r,authFailed:i,notFoundAsIdentity:a})),ee!==null){p();let e=ee;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),c.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}o&&m.dismiss()},t[83]=v,t[84]=n.project,t[85]=T,t[86]=D,t[87]=lt,t[88]=m,t[89]=ut):ut=t[89];let dt=ut,ft;t[90]!==dt||t[91]!==x.phase||t[92]!==n.worktree||t[93]!==D?(ft=function(){x.phase===`ready`&&(console.log(h({branch_dialog_action:`open-worktree`,branch:D})),S(he),n.worktree.checkout({branch:D}).then(e=>{dt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),dt(null)}))},t[90]=dt,t[91]=x.phase,t[92]=n.worktree,t[93]=D,t[94]=ft):ft=t[94];let pt=ft,mt;t[95]!==v||t[96]!==x.otherWorktreePath||t[97]!==x.phase||t[98]!==n.project||t[99]!==T||t[100]!==D||t[101]!==m?(mt=function(){if(x.phase!==`branch-in-other-worktree`)return;let e=x.otherWorktreePath;console.log(h({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),c.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=v,t[96]=x.otherWorktreePath,t[97]=x.phase,t[98]=n.project,t[99]=T,t[100]=D,t[101]=m,t[102]=mt):mt=t[102];let ht=mt,gt;t[103]!==x.phase||t[104]!==x.resolution||t[105]!==m?(gt=function(){console.log(h({branch_dialog_action:`cancel`,verdict_cell:x.phase===`verdict`?x.resolution.kind:void 0})),m.dismiss()},t[103]=x.phase,t[104]=x.resolution,t[105]=m,t[106]=gt):gt=t[106];let k=gt,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J;if(t[107]!==v||t[108]!==x.info||t[109]!==x.otherWorktreePath||t[110]!==x.phase||t[111]!==x.resolution||t[112]!==k||t[113]!==Xe||t[114]!==T.branch||t[115]!==T.owner||t[116]!==T.repo||t[117]!==T.target||t[118]!==D||t[119]!==w){q=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?ue(x.info):null;let e;t[139]!==x.info||t[140]!==x.phase||t[141]!==Xe?(e=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?de(x.info):Xe??`HEAD`,t[139]=x.info,t[140]=x.phase,t[141]=Xe,t[142]=e):e=t[142];let n=e;I=x.phase===`switching`||x.phase===`awaiting-cc1-recycle`,N=x.phase===`creating-worktree`;let i;t[143]===v?i=t[144]:(i=v({id:`OuY8t9`}),t[143]=v,t[144]=i),P=i;let a;t[145]===v?a=t[146]:(a=v({id:`XZkdtg`}),t[145]=v,t[146]=a),F=a;let o;t[147]===v?o=t[148]:(o=v({id:`VTulZj`}),t[147]=v,t[148]=o),J=o;let re=x.phase===`loading`,c=x.phase===`error`;M=ae,G=!0,t[149]===k?K=t[150]:(K=e=>{e||k()},t[149]=k,t[150]=K),j=s,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Ee,U=Te;let u;t[151]===w?u=t[152]:(u=(0,y.jsx)(te,{children:(0,y.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:w}})}),t[151]=w,t[152]=u);let oe=T.owner,se=T.repo,f;t[153]===T.target?f=t[154]:(f=l(T.target),t[153]=T.target,t[154]=f);let p;t[155]!==T.owner||t[156]!==T.repo||t[157]!==f?(p=(0,y.jsx)(ee,{className:`sr-only`,children:(0,y.jsx)(r,{id:`f8jU-L`,values:{0:oe,1:se,2:f}})}),t[155]=T.owner,t[156]=T.repo,t[157]=f,t[158]=p):p=t[158],t[159]!==u||t[160]!==p?(W=(0,y.jsxs)(ie,{children:[u,p]}),t[159]=u,t[160]=p,t[161]=W):W=t[161],A=ne;let m=T.owner,h=T.repo,g;t[162]===T.target?g=t[163]:(g=l(T.target),t[162]=T.target,t[163]=g),t[164]!==T.branch||t[165]!==T.owner||t[166]!==T.repo||t[167]!==T.target.kind||t[168]!==g?(L=(0,y.jsx)(`div`,{className:`mb-4`,children:(0,y.jsx)(ce,{owner:m,repo:h,path:g,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=T.branch,t[165]=T.owner,t[166]=T.repo,t[167]=T.target.kind,t[168]=g,t[169]=L):L=t[169],R=x.phase===`branch-in-other-worktree`?(0,y.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,y.jsx)(`p`,{className:`leading-6`,children:(0,y.jsx)(r,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,y.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:x.otherWorktreePath})]}):x.phase===`verdict-pending`?(0,y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,y.jsx)(r,{id:`Uay5NL`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`renamed`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,y.jsx)(r,{id:`P0HC30`,values:{0:x.resolution.renamedTo,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`diverged`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,y.jsx)(r,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):re?(0,y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`jerqF0`})]}):c?(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,y.jsx)(r,{id:`w4hMYl`})}):q?.kind===`D`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`DTI-fp`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`_902BE`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,y.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,y.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,y.jsx)(r,{id:`n2lRue`})}),(0,y.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(we)})]}):null,t[107]=v,t[108]=x.info,t[109]=x.otherWorktreePath,t[110]=x.phase,t[111]=x.resolution,t[112]=k,t[113]=Xe,t[114]=T.branch,t[115]=T.owner,t[116]=T.repo,t[117]=T.target,t[118]=D,t[119]=w,t[120]=A,t[121]=j,t[122]=M,t[123]=N,t[124]=P,t[125]=F,t[126]=I,t[127]=L,t[128]=R,t[129]=z,t[130]=B,t[131]=V,t[132]=H,t[133]=U,t[134]=W,t[135]=G,t[136]=K,t[137]=q,t[138]=J}else A=t[120],j=t[121],M=t[122],N=t[123],P=t[124],F=t[125],I=t[126],L=t[127],R=t[128],z=t[129],B=t[130],V=t[131],H=t[132],U=t[133],W=t[134],G=t[135],K=t[136],q=t[137],J=t[138];let Y;t[170]===I?Y=t[171]:(Y=I?(0,y.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=I,t[171]=Y);let X;t[172]===N?X=t[173]:(X=N?(0,y.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=N,t[173]=X);let Z;t[174]!==A||t[175]!==L||t[176]!==R||t[177]!==z||t[178]!==Y||t[179]!==X?(Z=(0,y.jsxs)(A,{children:[L,R,z,Y,X]}),t[174]=A,t[175]=L,t[176]=R,t[177]=z,t[178]=Y,t[179]=X,t[180]=Z):Z=t[180];let _t;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,y.jsx)(r,{id:`dEgA5A`}),t[181]=_t):_t=t[181];let Q;t[182]===k?Q=t[183]:(Q=(0,y.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:k,"data-testid":`share-branch-switch-cancel`,children:_t}),t[182]=k,t[183]=Q);let vt;t[184]!==x.phase||t[185]!==x.resolution||t[186]!==N||t[187]!==st||t[188]!==rt||t[189]!==pt||t[190]!==ht||t[191]!==at||t[192]!==$e||t[193]!==tt||t[194]!==P||t[195]!==F||t[196]!==I||t[197]!==q||t[198]!==J?(vt=x.phase===`branch-in-other-worktree`?(0,y.jsx)(o,{onClick:ht,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,y.jsx)(r,{id:`hyCxJY`})}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsxs)(o,{onClick:tt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`uA_jXp`})]}):x.resolution.kind===`renamed`?(0,y.jsxs)(o,{onClick:rt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`AItsE5`})]}):x.resolution.kind===`diverged`?(0,y.jsxs)(o,{onClick:at,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,y.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[q?.openCurrentEnabled?(0,y.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:st,disabled:I||N,"data-testid":`share-branch-switch-open-current`,children:[(0,y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,y.jsx)(o,{variant:`outline`,onClick:$e,disabled:!q?.switchEnabled||I||N,"aria-disabled":!q?.switchEnabled||I||N,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),F]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),F]})}),(0,y.jsx)(o,{onClick:pt,disabled:!q||I||N,"data-testid":`share-branch-switch-worktree`,children:N?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),J]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),J]})})]}),t[184]=x.phase,t[185]=x.resolution,t[186]=N,t[187]=st,t[188]=rt,t[189]=pt,t[190]=ht,t[191]=at,t[192]=$e,t[193]=tt,t[194]=P,t[195]=F,t[196]=I,t[197]=q,t[198]=J,t[199]=vt):vt=t[199];let yt;t[200]!==Q||t[201]!==vt?(yt=(0,y.jsxs)(re,{className:`sm:justify-between`,children:[Q,vt]}),t[200]=Q,t[201]=vt,t[202]=yt):yt=t[202];let $;t[203]!==j||t[204]!==B||t[205]!==V||t[206]!==H||t[207]!==U||t[208]!==W||t[209]!==Z||t[210]!==yt?($=(0,y.jsxs)(j,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Z,yt]}),t[203]=j,t[204]=B,t[205]=V,t[206]=H,t[207]=U,t[208]=W,t[209]=Z,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==M||t[213]!==G||t[214]!==K||t[215]!==$?(bt=(0,y.jsx)(M,{open:G,onOpenChange:K,children:$}),t[212]=M,t[213]=G,t[214]=K,t[215]=$,t[216]=bt):bt=t[216],bt}function we(e){return(0,y.jsx)(`li`,{children:(0,y.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Te(e){e.preventDefault()}function Ee(e){e.preventDefault()}function De(){return m.request()}function Oe(e){return ye(e,null).state}function ke(e){return ve(e,null)}function Ae(e){return pe(e,null)}function je(){return null}export{b as ShareBranchSwitchDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-Cym3gapE.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-CTNat3T_.js";import{Mn as u,kn as d}from"./dist-B5qwv8-p.js";import{n as f}from"./dist-CJhtNlOm2.js";import{t as p}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ie}from"./spinner-t7GahFcQ.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-D7nvngvO.js";import{t as se}from"./share-metadata-rows-DPgPU-ev.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function C(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return{kind:e.target.kind,path:p(e.target),repositoryPath:p(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function D(e){return e!==null&&e.kind===`launcher-consent`}function O(e){return e!==null&&e.kind===`launcher-miss`}function k(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,j),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(A));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=O(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=D(o)?o:null,t[6]=o,t[7]=d);let p=d??u;if(!p)return null;let ie;return t[8]!==p||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(ie=(0,T.jsx)(M,{payload:p,bridge:n,cloneController:r,store:a},ee),t[8]=p,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=ie):ie=t[13],ie}function A(e){return e+1}function j(){return null}function M(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[M,pe]=(0,v.useState)(!1),[N,me]=(0,v.useState)(!1),[P,he]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),ge=(0,v.useRef)(!1),_e=(0,v.useRef)(null),ve,ye;t[0]===P?(ve=t[1],ye=t[2]):(ve=()=>{P&&_e.current?.focus()},ye=[P],t[0]=P,t[1]=ve,t[2]=ye),(0,v.useEffect)(ve,ye);let be;t[3]!==F||t[4]!==n?(be=()=>{D(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,repositoryPath:p(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=be):be=t[5];let xe;t[6]===n?xe=t[7]:(xe=[n],t[6]=n,t[7]=xe),(0,v.useEffect)(be,xe);let Se;t[8]!==A||t[9]!==h||t[10]!==n?(Se=()=>{if(!h||!O(n)||A!==null||ge.current)return;ge.current=!0,pe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{j(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),j({authenticated:!1,host:e})}).finally(()=>{pe(!1)})},t[8]=A,t[9]=h,t[10]=n,t[11]=Se):Se=t[11];let Ce;t[12]!==A||t[13]!==n?(Ce=[n,A],t[12]=A,t[13]=n,t[14]=Ce):Ce=t[14],(0,v.useEffect)(Se,Ce);let L=O(n)?n:null,we=D(n)?n:null,R=L?.share??we?.share??null,z,Te,B,V,H,Ee,U,W;if(t[15]!==x||t[16]!==M||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){U=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],W=n,B=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;he(null),me(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),me(!1),he({detail:t instanceof Error?t.message:String(t)});return}if(me(!1),n.kind===`error`){he({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:E(L.share)}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==M||t[38]!==h?(i=async function(){if(!(!h||M)){pe(!0);try{let e=await h.startSignIn();pe(!1),e!==null&&j(e)}catch(e){let t=e;pe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=M,t[38]=h,t[39]=i):i=t[39],H=i,V=async function(){if(!(!L||!e||w)){he(null),k(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:E(L.share)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}k(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(fe),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),I(de),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(ue),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===W?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[50]=W,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],U=ue;break bb0}if(!L||!R||!e){U=null;break bb0}z=h!==void 0&&!N;let D;t[103]!==x||t[104]!==N?(D=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=D):D=t[105],Te=D,Ee=d(e)}t[15]=x,t[16]=M,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=Te,t[27]=B,t[28]=V,t[29]=H,t[30]=Ee,t[31]=U,t[32]=W}else z=t[25],Te=t[26],B=t[27],V=t[28],H=t[29],Ee=t[30],U=t[31],W=t[32];if(U!==Symbol.for(`react.early_return_sentinel`))return U;let De=Ee,Oe=A?.authenticated?A.login:void 0,ke;t[106]===P?ke=t[107]:(ke=P?.detail?m(P.detail):``,t[106]=P,t[107]=ke);let Ae=ke,G;t[108]===_?G=t[109]:(G=e=>{e||_.dismiss()},t[108]=_,t[109]=G);let K;t[110]===W?K=t[111]:(K=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[110]=W,t[111]=K);let q;t[112]===R.target?q=t[113]:(q=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=q);let J;t[114]!==R.owner||t[115]!==R.repo||t[116]!==q?(J=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,q]}),t[114]=R.owner,t[115]=R.repo,t[116]=q,t[117]=J):J=t[117];let je=R.owner,Me=R.repo,Y;t[118]===R.target?Y=t[119]:(Y=p(R.target),t[118]=R.target,t[119]=Y);let X;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==Y?(X=(0,T.jsx)(se,{owner:je,repo:Me,path:Y,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=Y,t[125]=X):X=t[125];let Z;t[126]!==K||t[127]!==J||t[128]!==X?(Z=(0,T.jsxs)(c,{children:[K,J,X]}),t[126]=K,t[127]=J,t[128]=X,t[129]=Z):Z=t[129];let Q;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Ae||t[134]!==Te||t[135]!==N||t[136]!==B||t[137]!==V||t[138]!==w?(Q=P?(0,T.jsxs)(`div`,{ref:_e,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),Ae?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ae,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{B()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{V()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{B()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:Te}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{V()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Ae,t[134]=Te,t[135]=N,t[136]=B,t[137]=V,t[138]=w,t[139]=Q):Q=t[139];let Ne;t[140]!==M||t[141]!==A||t[142]!==h||t[143]!==H||t[144]!==Oe?(Ne=h?(0,T.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:A===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):A.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Oe},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{H()},disabled:M,children:M?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=M,t[141]=A,t[142]=h,t[143]=H,t[144]=Oe,t[145]=Ne):Ne=t[145];let Pe;t[146]!==P||t[147]!==De?(Pe=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:De},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=De,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Q||t[150]!==Ne||t[151]!==Pe?(Fe=(0,T.jsxs)(re,{children:[Q,Ne,Pe]}),t[149]=Q,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===_?Ie=t[154]:(Ie=()=>_.dismiss(),t[153]=_,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==Z||t[159]!==Fe||t[160]!==Re?($=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Z,Fe,Re]}),t[158]=Z,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==G||t[163]!==$?(ze=(0,T.jsx)(l,{open:!0,onOpenChange:G,children:$}),t[162]=G,t[163]=$,t[164]=ze):ze=t[164],ze}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function ue(e){return e===null?e:w(e)}function de(e){return e===null?e:C(e,{ok:!0})}function fe(e){return e===null?e:x(e)}export{k as ShareReceiveDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-Cym3gapE.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-CTNat3T_.js";import{Mn as u,kn as d}from"./dist-7elyeD1s.js";import{n as f}from"./dist-CJhtNlOm2.js";import{t as p}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ie}from"./spinner-t7GahFcQ.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-DMcyiDfj.js";import{t as se}from"./share-metadata-rows-DPgPU-ev.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function C(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return{kind:e.target.kind,path:p(e.target),repositoryPath:p(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function D(e){return e!==null&&e.kind===`launcher-consent`}function O(e){return e!==null&&e.kind===`launcher-miss`}function k(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,j),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(A));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=O(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=D(o)?o:null,t[6]=o,t[7]=d);let p=d??u;if(!p)return null;let ie;return t[8]!==p||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(ie=(0,T.jsx)(M,{payload:p,bridge:n,cloneController:r,store:a},ee),t[8]=p,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=ie):ie=t[13],ie}function A(e){return e+1}function j(){return null}function M(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[M,pe]=(0,v.useState)(!1),[N,me]=(0,v.useState)(!1),[P,he]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),ge=(0,v.useRef)(!1),_e=(0,v.useRef)(null),ve,ye;t[0]===P?(ve=t[1],ye=t[2]):(ve=()=>{P&&_e.current?.focus()},ye=[P],t[0]=P,t[1]=ve,t[2]=ye),(0,v.useEffect)(ve,ye);let be;t[3]!==F||t[4]!==n?(be=()=>{D(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,repositoryPath:p(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=be):be=t[5];let xe;t[6]===n?xe=t[7]:(xe=[n],t[6]=n,t[7]=xe),(0,v.useEffect)(be,xe);let Se;t[8]!==A||t[9]!==h||t[10]!==n?(Se=()=>{if(!h||!O(n)||A!==null||ge.current)return;ge.current=!0,pe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{j(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),j({authenticated:!1,host:e})}).finally(()=>{pe(!1)})},t[8]=A,t[9]=h,t[10]=n,t[11]=Se):Se=t[11];let Ce;t[12]!==A||t[13]!==n?(Ce=[n,A],t[12]=A,t[13]=n,t[14]=Ce):Ce=t[14],(0,v.useEffect)(Se,Ce);let L=O(n)?n:null,we=D(n)?n:null,R=L?.share??we?.share??null,z,Te,B,V,H,Ee,U,W;if(t[15]!==x||t[16]!==M||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){U=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],W=n,B=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;he(null),me(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),me(!1),he({detail:t instanceof Error?t.message:String(t)});return}if(me(!1),n.kind===`error`){he({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:E(L.share)}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==M||t[38]!==h?(i=async function(){if(!(!h||M)){pe(!0);try{let e=await h.startSignIn();pe(!1),e!==null&&j(e)}catch(e){let t=e;pe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=M,t[38]=h,t[39]=i):i=t[39],H=i,V=async function(){if(!(!L||!e||w)){he(null),k(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:E(L.share)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}k(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(fe),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),I(de),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(ue),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===W?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[50]=W,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],U=ue;break bb0}if(!L||!R||!e){U=null;break bb0}z=h!==void 0&&!N;let D;t[103]!==x||t[104]!==N?(D=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=D):D=t[105],Te=D,Ee=d(e)}t[15]=x,t[16]=M,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=Te,t[27]=B,t[28]=V,t[29]=H,t[30]=Ee,t[31]=U,t[32]=W}else z=t[25],Te=t[26],B=t[27],V=t[28],H=t[29],Ee=t[30],U=t[31],W=t[32];if(U!==Symbol.for(`react.early_return_sentinel`))return U;let De=Ee,Oe=A?.authenticated?A.login:void 0,ke;t[106]===P?ke=t[107]:(ke=P?.detail?m(P.detail):``,t[106]=P,t[107]=ke);let Ae=ke,G;t[108]===_?G=t[109]:(G=e=>{e||_.dismiss()},t[108]=_,t[109]=G);let K;t[110]===W?K=t[111]:(K=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[110]=W,t[111]=K);let q;t[112]===R.target?q=t[113]:(q=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=q);let J;t[114]!==R.owner||t[115]!==R.repo||t[116]!==q?(J=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,q]}),t[114]=R.owner,t[115]=R.repo,t[116]=q,t[117]=J):J=t[117];let je=R.owner,Me=R.repo,Y;t[118]===R.target?Y=t[119]:(Y=p(R.target),t[118]=R.target,t[119]=Y);let X;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==Y?(X=(0,T.jsx)(se,{owner:je,repo:Me,path:Y,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=Y,t[125]=X):X=t[125];let Z;t[126]!==K||t[127]!==J||t[128]!==X?(Z=(0,T.jsxs)(c,{children:[K,J,X]}),t[126]=K,t[127]=J,t[128]=X,t[129]=Z):Z=t[129];let Q;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Ae||t[134]!==Te||t[135]!==N||t[136]!==B||t[137]!==V||t[138]!==w?(Q=P?(0,T.jsxs)(`div`,{ref:_e,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),Ae?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ae,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{B()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{V()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{B()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:Te}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{V()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Ae,t[134]=Te,t[135]=N,t[136]=B,t[137]=V,t[138]=w,t[139]=Q):Q=t[139];let Ne;t[140]!==M||t[141]!==A||t[142]!==h||t[143]!==H||t[144]!==Oe?(Ne=h?(0,T.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:A===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):A.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Oe},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{H()},disabled:M,children:M?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=M,t[141]=A,t[142]=h,t[143]=H,t[144]=Oe,t[145]=Ne):Ne=t[145];let Pe;t[146]!==P||t[147]!==De?(Pe=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:De},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=De,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Q||t[150]!==Ne||t[151]!==Pe?(Fe=(0,T.jsxs)(re,{children:[Q,Ne,Pe]}),t[149]=Q,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===_?Ie=t[154]:(Ie=()=>_.dismiss(),t[153]=_,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==Z||t[159]!==Fe||t[160]!==Re?($=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Z,Fe,Re]}),t[158]=Z,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==G||t[163]!==$?(ze=(0,T.jsx)(l,{open:!0,onOpenChange:G,children:$}),t[162]=G,t[163]=$,t[164]=ze):ze=t[164],ze}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function ue(e){return e===null?e:w(e)}function de(e){return e===null?e:C(e,{ok:!0})}function fe(e){return e===null?e:x(e)}export{k as ShareReceiveDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-CTNat3T_.js";import{a as l,i as u,n as d,o as f,r as p}from"./pending-receive-nav-store-Cfa5notj.js";import{t as m}from"./miss-dialog-store-DVpIaq34.js";import{f as h,p as g}from"./doc-paths-mRmnn5mL.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(m.subscribe,m.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=f(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){m.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(l(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){p.arm(d(n,e)),window.location.hash=n.kind===`folder`?g(e):h(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(s,{children:(0,y.jsx)(i,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(u,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(o,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(c,{open:!0,onOpenChange:D,children:(0,y.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-CTNat3T_.js";import{a as l,i as u,n as d,o as f,r as p}from"./pending-receive-nav-store-DC3PrSPg.js";import{t as m}from"./miss-dialog-store-DVpIaq34.js";import{f as h,p as g}from"./doc-paths-D_8UvPYx.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(m.subscribe,m.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=f(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){m.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(l(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){p.arm(d(n,e)),window.location.hash=n.kind===`folder`?g(e):h(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(s,{children:(0,y.jsx)(i,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(u,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(o,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(c,{open:!0,onOpenChange:D,children:(0,y.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{i,n as a,r as o,t as s}from"./tooltip-DttaCTqz.js";import{dt as c}from"./dist-B5qwv8-p.js";import{t as l}from"./triangle-alert-GeclLtDN.js";var u=r(),d=e();function f(e){return e<1e3?`${e}`:`${Math.round(e/100)/10}k`}function p(e){let t=(0,u.c)(33),{tokens:r,budget:c}=e,{_:p}=n(),m=c!==void 0&&r>c,h,g,_,v,y,b,x,S;if(t[0]!==p||t[1]!==c||t[2]!==m||t[3]!==r){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c===void 0?``:f(c),n=m||void 0,u=m?`text-amber-600 dark:text-amber-500`:void 0,C;t[12]===r?C=t[13]:(C=f(r),t[12]=r,t[13]=C);let w=m?(0,d.jsx)(`span`,{role:`img`,"aria-label":p({id:`nem6R7`,values:{budgetLabel:e}}),children:(0,d.jsx)(l,{className:`ms-0.5 inline size-3 align-[-0.1em]`,"aria-hidden":`true`})}):null,T;t[14]!==n||t[15]!==u||t[16]!==C||t[17]!==w?(T=(0,d.jsxs)(`span`,{"data-over-budget":n,className:u,children:[C,w]}),t[14]=n,t[15]=u,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E=T;if(!m){S=E;break bb0}_=o,g=s,t[19]===E?x=t[20]:(x=(0,d.jsx)(i,{asChild:!0,children:E}),t[19]=E,t[20]=x),h=a,v=`right`,y=`max-w-xs`,b=p({id:`JsHvhz`,values:{budgetLabel:e}})}t[0]=p,t[1]=c,t[2]=m,t[3]=r,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=S}else h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[21]!==h||t[22]!==v||t[23]!==y||t[24]!==b?(C=(0,d.jsx)(h,{side:v,className:y,children:b}),t[21]=h,t[22]=v,t[23]=y,t[24]=b,t[25]=C):C=t[25];let w;t[26]!==g||t[27]!==x||t[28]!==C?(w=(0,d.jsxs)(g,{children:[x,C]}),t[26]=g,t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==_||t[31]!==w?(T=(0,d.jsx)(_,{children:w}),t[30]=_,t[31]=w,t[32]=T):T=t[32],T}function m(e){let n=(0,u.c)(22),{size:r}=e,i=r.alwaysOn+r.onTrigger+r.onDemand,a;n[0]===r.alwaysOn?a=n[1]:(a=(0,d.jsx)(p,{tokens:r.alwaysOn,budget:100}),n[0]=r.alwaysOn,n[1]=a);let o;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,d.jsx)(t,{id:`eTsJYJ`}),n[2]=o):o=n[2];let s;n[3]===a?s=n[4]:(s=(0,d.jsxs)(`span`,{children:[a,` `,o]}),n[3]=a,n[4]=s);let l;n[5]===r.onTrigger?l=n[6]:(l=(0,d.jsxs)(`span`,{children:[(0,d.jsx)(p,{tokens:r.onTrigger,budget:c}),` SKILL.md`]}),n[5]=r.onTrigger,n[6]=l);let f;n[7]===r.onDemand?f=n[8]:(f=(0,d.jsx)(p,{tokens:r.onDemand}),n[7]=r.onDemand,n[8]=f);let m;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,d.jsx)(t,{id:`ae9Ozt`}),n[9]=m):m=n[9];let h;n[10]===f?h=n[11]:(h=(0,d.jsxs)(`span`,{children:[f,` `,m]}),n[10]=f,n[11]=h);let g;n[12]===i?g=n[13]:(g=(0,d.jsx)(p,{tokens:i}),n[12]=i,n[13]=g);let _;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,d.jsx)(t,{id:`ONchxy`}),n[14]=_):_=n[14];let v;n[15]===g?v=n[16]:(v=(0,d.jsxs)(`span`,{className:`text-foreground/80`,children:[g,` `,_]}),n[15]=g,n[16]=v);let y;return n[17]!==v||n[18]!==s||n[19]!==l||n[20]!==h?(y=(0,d.jsxs)(`span`,{"data-testid":`skill-cost-value`,className:`flex flex-col gap-0.5 font-mono text-[13px] text-muted-foreground`,children:[s,l,h,v]}),n[17]=v,n[18]=s,n[19]=l,n[20]=h,n[21]=y):y=n[21],y}export{f as n,m as t};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{i,n as a,r as o,t as s}from"./tooltip-DttaCTqz.js";import{dt as c}from"./dist-7elyeD1s.js";import{t as l}from"./triangle-alert-GeclLtDN.js";var u=r(),d=e();function f(e){return e<1e3?`${e}`:`${Math.round(e/100)/10}k`}function p(e){let t=(0,u.c)(33),{tokens:r,budget:c}=e,{_:p}=n(),m=c!==void 0&&r>c,h,g,_,v,y,b,x,S;if(t[0]!==p||t[1]!==c||t[2]!==m||t[3]!==r){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c===void 0?``:f(c),n=m||void 0,u=m?`text-amber-600 dark:text-amber-500`:void 0,C;t[12]===r?C=t[13]:(C=f(r),t[12]=r,t[13]=C);let w=m?(0,d.jsx)(`span`,{role:`img`,"aria-label":p({id:`nem6R7`,values:{budgetLabel:e}}),children:(0,d.jsx)(l,{className:`ms-0.5 inline size-3 align-[-0.1em]`,"aria-hidden":`true`})}):null,T;t[14]!==n||t[15]!==u||t[16]!==C||t[17]!==w?(T=(0,d.jsxs)(`span`,{"data-over-budget":n,className:u,children:[C,w]}),t[14]=n,t[15]=u,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E=T;if(!m){S=E;break bb0}_=o,g=s,t[19]===E?x=t[20]:(x=(0,d.jsx)(i,{asChild:!0,children:E}),t[19]=E,t[20]=x),h=a,v=`right`,y=`max-w-xs`,b=p({id:`JsHvhz`,values:{budgetLabel:e}})}t[0]=p,t[1]=c,t[2]=m,t[3]=r,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=S}else h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[21]!==h||t[22]!==v||t[23]!==y||t[24]!==b?(C=(0,d.jsx)(h,{side:v,className:y,children:b}),t[21]=h,t[22]=v,t[23]=y,t[24]=b,t[25]=C):C=t[25];let w;t[26]!==g||t[27]!==x||t[28]!==C?(w=(0,d.jsxs)(g,{children:[x,C]}),t[26]=g,t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==_||t[31]!==w?(T=(0,d.jsx)(_,{children:w}),t[30]=_,t[31]=w,t[32]=T):T=t[32],T}function m(e){let n=(0,u.c)(22),{size:r}=e,i=r.alwaysOn+r.onTrigger+r.onDemand,a;n[0]===r.alwaysOn?a=n[1]:(a=(0,d.jsx)(p,{tokens:r.alwaysOn,budget:100}),n[0]=r.alwaysOn,n[1]=a);let o;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,d.jsx)(t,{id:`eTsJYJ`}),n[2]=o):o=n[2];let s;n[3]===a?s=n[4]:(s=(0,d.jsxs)(`span`,{children:[a,` `,o]}),n[3]=a,n[4]=s);let l;n[5]===r.onTrigger?l=n[6]:(l=(0,d.jsxs)(`span`,{children:[(0,d.jsx)(p,{tokens:r.onTrigger,budget:c}),` SKILL.md`]}),n[5]=r.onTrigger,n[6]=l);let f;n[7]===r.onDemand?f=n[8]:(f=(0,d.jsx)(p,{tokens:r.onDemand}),n[7]=r.onDemand,n[8]=f);let m;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,d.jsx)(t,{id:`ae9Ozt`}),n[9]=m):m=n[9];let h;n[10]===f?h=n[11]:(h=(0,d.jsxs)(`span`,{children:[f,` `,m]}),n[10]=f,n[11]=h);let g;n[12]===i?g=n[13]:(g=(0,d.jsx)(p,{tokens:i}),n[12]=i,n[13]=g);let _;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,d.jsx)(t,{id:`ONchxy`}),n[14]=_):_=n[14];let v;n[15]===g?v=n[16]:(v=(0,d.jsxs)(`span`,{className:`text-foreground/80`,children:[g,` `,_]}),n[15]=g,n[16]=v);let y;return n[17]!==v||n[18]!==s||n[19]!==l||n[20]!==h?(y=(0,d.jsxs)(`span`,{"data-testid":`skill-cost-value`,className:`flex flex-col gap-0.5 font-mono text-[13px] text-muted-foreground`,children:[s,l,h,v]}),n[17]=v,n[18]=s,n[19]=l,n[20]=h,n[21]=y):y=n[21],y}export{f as n,m as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./square-pen-CBGVrQUa.js";import{s as i}from"./skill-scope-BVNk6qeO.js";import{t as a}from"./SkillModeBanner-Cfij5biF.js";var o=n(),s=e();function c(e){let n=(0,o.c)(7),{name:c}=e,l;n[0]===c?l=n[1]:(l=i(c),n[0]=c,n[1]=l);let u;n[2]===l?u=n[3]:(u=(0,s.jsx)(`strong`,{className:`font-medium text-foreground`,children:l}),n[2]=l,n[3]=u);let d=u,f;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(r,{className:`size-4`,"aria-hidden":!0}),n[4]=f):f=n[4];let p;return n[5]===d?p=n[6]:(p=(0,s.jsx)(a,{icon:f,children:(0,s.jsx)(t,{id:`i-wHEp`,values:{boldName:d}})}),n[5]=d,n[6]=p),p}export{c as SkillEditBanner};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./square-pen-CBGVrQUa.js";import{s as i}from"./skill-scope-CVSSymVB.js";import{t as a}from"./SkillModeBanner-Cfij5biF.js";var o=n(),s=e();function c(e){let n=(0,o.c)(7),{name:c}=e,l;n[0]===c?l=n[1]:(l=i(c),n[0]=c,n[1]=l);let u;n[2]===l?u=n[3]:(u=(0,s.jsx)(`strong`,{className:`font-medium text-foreground`,children:l}),n[2]=l,n[3]=u);let d=u,f;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(r,{className:`size-4`,"aria-hidden":!0}),n[4]=f):f=n[4];let p;return n[5]===d?p=n[6]:(p=(0,s.jsx)(a,{icon:f,children:(0,s.jsx)(t,{id:`i-wHEp`,values:{boldName:d}})}),n[5]=d,n[6]=p),p}export{c as SkillEditBanner};