@inkeep/open-knowledge 0.83.0-beta.8 → 0.84.0-beta.0

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 (83) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-CJTSHFDQ.mjs +1 -0
  3. package/dist/{dist-B9DtIzpt.mjs → dist-BUsVlOD-.mjs} +1 -1
  4. package/dist/{dist-JTJCXKWa.mjs → dist-BmMYmJrU.mjs} +303 -303
  5. package/dist/index.mjs +1 -1
  6. package/dist/init-6eE8auCX.mjs +1 -0
  7. package/dist/{init-Dc8_JDpj.mjs → init-D29QcTZq.mjs} +2 -2
  8. package/dist/{launch-json-removal-DbQwC4O1.mjs → launch-json-removal-5ndYNGXL.mjs} +1 -1
  9. package/dist/{loader-KO7Y4yHr.mjs → loader-CUPoyzHp.mjs} +1 -1
  10. package/dist/loader-CisLPZPW.mjs +1 -0
  11. package/dist/{open-browser-BIyeIBW0.mjs → open-browser-BM0E2IrX.mjs} +1 -1
  12. package/dist/{preview-n4D4OfhY.mjs → preview-BfxmnsOn.mjs} +1 -1
  13. package/dist/preview-DQ-4J61L.mjs +1 -0
  14. package/dist/public/assets/{AccountSection-Chcqq4Rn.js → AccountSection-BsoknTRm.js} +1 -1
  15. package/dist/public/assets/{ActivityModeContent-VRaEekKQ.js → ActivityModeContent-DZbyWBlo.js} +1 -1
  16. package/dist/public/assets/{AddPropertiesButton-D3i8DDw1.js → AddPropertiesButton-DvtOOL5J.js} +1 -1
  17. package/dist/public/assets/{AgentDiffPane-iLFWvxJg.js → AgentDiffPane-D9olUVts.js} +1 -1
  18. package/dist/public/assets/{AttachmentsSection-C8b3L8oR.js → AttachmentsSection-DdqsNOtE.js} +1 -1
  19. package/dist/public/assets/{CodeMirrorPropInput-Cza70VJH.js → CodeMirrorPropInput-BTCkQ8gy.js} +1 -1
  20. package/dist/public/assets/{ContentRulesSection-g9Do-G-T.js → ContentRulesSection-BPc0bEex.js} +1 -1
  21. package/dist/public/assets/{DocumentContext-DcLfGXeI.js → DocumentContext-Cgpe7PUq.js} +1 -1
  22. package/dist/public/assets/{EditorModeToggle-aZMvzwYT.js → EditorModeToggle-8PbuUKPX.js} +1 -1
  23. package/dist/public/assets/{ExcalidrawDocEditor-CO9SJ8TB.js → ExcalidrawDocEditor-DPjKh0Z6.js} +1 -1
  24. package/dist/public/assets/FeedbackForm-w2RNhl0R.js +1 -0
  25. package/dist/public/assets/{ImportSkillDialog-CpeiJvUY.js → ImportSkillDialog-BRMCNFIO.js} +1 -1
  26. package/dist/public/assets/{LinkPreviewsSection-CDm6lROI.js → LinkPreviewsSection-DrVzxhzA.js} +1 -1
  27. package/dist/public/assets/{LintConfigEditor-CgmITWmp.js → LintConfigEditor-CYgb3HLw.js} +1 -1
  28. package/dist/public/assets/{LintingSection-DX5R516q.js → LintingSection-DwEExyYA.js} +1 -1
  29. package/dist/public/assets/{ManagedArtifactProperties-4vZd220h.js → ManagedArtifactProperties-Cejw-D7l.js} +1 -1
  30. package/dist/public/assets/ManagedArtifactProperties-sO6f840l.js +1 -0
  31. package/dist/public/assets/{MermaidDocEditor-DAYu64J5.js → MermaidDocEditor-TV8MQtbb.js} +1 -1
  32. package/dist/public/assets/{NetworkAccessSection-CPkK5yoz.js → NetworkAccessSection-G-tyEPOW.js} +1 -1
  33. package/dist/public/assets/{PropertyDisplayRow-Dh-7Ytaq.js → PropertyDisplayRow-DULpBoN1.js} +1 -1
  34. package/dist/public/assets/{PublishToGitHubDialog-BD0FxuNe.js → PublishToGitHubDialog-BcpO5RKl.js} +1 -1
  35. package/dist/public/assets/{SchemaConfigEditor-kGZrMizb.js → SchemaConfigEditor-D79vqFmf.js} +1 -1
  36. package/dist/public/assets/{SearchSection-D-XoY_-a.js → SearchSection-Dx8-C7aO.js} +1 -1
  37. package/dist/public/assets/{SessionsHost-BANbRx8e.js → SessionsHost-DhB6vMF-.js} +2 -2
  38. package/dist/public/assets/{SettingsDialogBody-f15Sg4NZ.js → SettingsDialogBody-BmlfRDFb.js} +2 -2
  39. package/dist/public/assets/{ShareReceiveMissDialog-DgPtHVze.js → ShareReceiveMissDialog-0PE01E7W.js} +1 -1
  40. package/dist/public/assets/{SkillToolbarControls-BacmWVVb.js → SkillToolbarControls-CT26YXuL.js} +1 -1
  41. package/dist/public/assets/{SourceEditor-DmmIGcpn.js → SourceEditor-DghQVHvX.js} +1 -1
  42. package/dist/public/assets/{SyncSection-B3qvlZnG.js → SyncSection-DmMPCcrO.js} +1 -1
  43. package/dist/public/assets/{SyncStatusBadge-CrhgKvf8.js → SyncStatusBadge-7CGaFHUk.js} +1 -1
  44. package/dist/public/assets/{TerminalSection-Dtw-wKoT.js → TerminalSection-BBA8y3S1.js} +1 -1
  45. package/dist/public/assets/{TerminalWindowApp-BvD0XdC6.js → TerminalWindowApp-DFmcq1vG.js} +1 -1
  46. package/dist/public/assets/{TextDocEditor-CUNmExI5.js → TextDocEditor-DxghXof_.js} +1 -1
  47. package/dist/public/assets/{ThreadView-CPPW0Dfp.js → ThreadView-BcdaDwyX.js} +1 -1
  48. package/dist/public/assets/{TimelineDiffPane-Dw4QtUm-.js → TimelineDiffPane-DbgES6nK.js} +1 -1
  49. package/dist/public/assets/{client-version-C-aFlRsC.js → client-version-uAhaPZPt.js} +1 -1
  50. package/dist/public/assets/{comment-chips-BMqI1RUZ.js → comment-chips-D7PAXgFJ.js} +1 -1
  51. package/dist/public/assets/{config-provider-Cs3B2_OX.js → config-provider-DBgrt1kx.js} +1 -1
  52. package/dist/public/assets/{doc-undo-manager-szCxH80V.js → doc-undo-manager-DGQuNlgn.js} +1 -1
  53. package/dist/public/assets/{index-CqWkPm5z.js → index-C_8iI96N.js} +8 -8
  54. package/dist/public/assets/{lint-plugins-CwlqYhnN.js → lint-plugins-24yMjYos.js} +1 -1
  55. package/dist/public/assets/{pending-receive-nav-store-Dmll1xaV.js → pending-receive-nav-store-ge0q0US7.js} +1 -1
  56. package/dist/public/assets/{progress-BOxsa6I6.js → progress-BXjvg4DI.js} +1 -1
  57. package/dist/public/assets/{selection-context-D4kyfjCo.js → selection-context-C68gF2Oq.js} +1 -1
  58. package/dist/public/assets/{src-CaHEUw28.js → src-COG_7U42.js} +1 -1
  59. package/dist/public/assets/{telemetry-impl-DChsPrpQ.js → telemetry-impl-C15v97Eo.js} +1 -1
  60. package/dist/public/assets/{telemetry-startup-B9nVffXq.js → telemetry-startup-B-aSb531.js} +1 -1
  61. package/dist/public/assets/{typing-burst-detector-C-nEZIsQ.js → typing-burst-detector-BKuWOIaA.js} +1 -1
  62. package/dist/public/assets/{use-activity-panel-CbdICT9Y.js → use-activity-panel-BgzoGLEn.js} +1 -1
  63. package/dist/public/assets/{use-open-skill-BunYAIpE.js → use-open-skill-CDNmRdpj.js} +1 -1
  64. package/dist/public/assets/{use-terminal-enabled-Vqy8aWBy.js → use-terminal-enabled-CYPFWXCG.js} +1 -1
  65. package/dist/public/assets/{use-timeline-entry-diff-DCMJfj6k.js → use-timeline-entry-diff-Cb24Bjqb.js} +1 -1
  66. package/dist/public/index.html +17 -17
  67. package/dist/{registry-probes-CrbLg6FH.mjs → registry-probes-NShX9Gbx.mjs} +1 -1
  68. package/dist/{removal-file-path-CBDcB9aY.mjs → removal-file-path-BdSClBgZ.mjs} +1 -1
  69. package/dist/{repair-launch-json-CcRM-s1c.mjs → repair-launch-json-C-OCcoOV.mjs} +1 -1
  70. package/dist/{repair-mcp-configs-BRMXs0MC.mjs → repair-mcp-configs-Ck7wXNVg.mjs} +1 -1
  71. package/dist/{src-3rZ7k4S6.mjs → src-BPKOub-z.mjs} +1 -1
  72. package/dist/src-CZcP6UNX.mjs +1 -0
  73. package/dist/{start-CMT-BjjJ.mjs → start-CPHxqFwe.mjs} +3 -3
  74. package/dist/start-s51e4yCV.mjs +1 -0
  75. package/package.json +4 -4
  76. package/dist/constants-DWohuTZz.mjs +0 -1
  77. package/dist/init-Q1pK7iF1.mjs +0 -1
  78. package/dist/loader-C5RE9SEB.mjs +0 -1
  79. package/dist/preview-D5hoFXnA.mjs +0 -1
  80. package/dist/public/assets/FeedbackForm-B2NFrqe2.js +0 -1
  81. package/dist/public/assets/ManagedArtifactProperties-DsJx8iXo.js +0 -1
  82. package/dist/src-BmkVYGLa.mjs +0 -1
  83. package/dist/start-BZCeDp8V.mjs +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-Dmll1xaV.js";import{t as l}from"./miss-dialog-store-CsiJb9Ou.js";import{c as u,i as d,n as f,s as p,t as m}from"./dialog-BJEjKJjL.js";import{l as h,u as g}from"./doc-hash-BJkweiX9.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?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)(p,{children:(0,y.jsx)(u,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(f,{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)(m,{open:!0,onOpenChange:D,children:(0,y.jsxs)(d,{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{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-ge0q0US7.js";import{t as l}from"./miss-dialog-store-CsiJb9Ou.js";import{c as u,i as d,n as f,s as p,t as m}from"./dialog-BJEjKJjL.js";import{l as h,u as g}from"./doc-hash-BJkweiX9.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?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)(p,{children:(0,y.jsx)(u,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(f,{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)(m,{open:!0,onOpenChange:D,children:(0,y.jsxs)(d,{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{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./select-Bu4Wm3Rf.js";import{t as m}from"./button-DzgjsZzC.js";import{l as h,n as g,r as _,t as v}from"./AddPropertiesButton-D3i8DDw1.js";import{a as y,h as b,r as x,t as S,u as C}from"./dropdown-menu-DtLu9NwU.js";import{n as w}from"./file-plus-DKxOZh2k.js";import{t as T}from"./list-plus-CYMJBvrm.js";import{p as E,t as D}from"./skill-scope-CxuIje2Y.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:m,triggerClassName:h}=e,{_:g}=i(),_=E(),v;t[0]===a?v=t[1]:(v=e=>a(e),t[0]=a,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`oCHfGC`}),t[2]=g,t[3]=y);let b;t[4]===h?b=t[5]:(b=o(`w-auto gap-1 text-xs font-mono uppercase`,h),t[4]=h,t[5]=b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(f,{}),t[6]=x):x=t[6];let S;t[7]!==y||t[8]!==b?(S=(0,k.jsx)(u,{size:`sm`,"aria-label":y,"data-testid":`skill-level-select`,className:b,children:x}),t[7]=y,t[8]=b,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(s,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===_?w=t[12]:(w=D.map(e=>(0,k.jsx)(c,{value:e,children:_[e]},e)),t[11]=_,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(l,{align:`end`,children:(0,k.jsxs)(d,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==m||t[16]!==v||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(p,{value:n,onValueChange:v,disabled:m,children:[S,T]}),t[15]=m,t[16]=v,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,k.jsx)(h,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:c,problemMessages:l}=e,{_:u}=i(),d;t[0]!==a||t[1]!==n?(d={scope:n,name:a},t[0]=a,t[1]=n,t[2]=d):d=t[2];let f=M(d),p;t[3]!==f.requestMove||t[4]!==n?(p=(0,k.jsx)(A,{value:n,onRequestMove:f.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=f.requestMove,t[4]=n,t[5]=p):p=t[5];let h;t[6]!==a||t[7]!==n?(h=(0,k.jsx)(_,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=h):h=t[8];let E;t[9]!==p||t[10]!==h?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,h]}),t[9]=p,t[10]=h,t[11]=E):E=t[11];let D;t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==o?(D=o?(0,k.jsx)(v,{onAddProperty:s,problemCount:c,problemMessages:l,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=c,t[14]=l,t[15]=o,t[16]=D):D=t[16];let j;t[17]===u?j=t[18]:(j=u({id:`Yzs3QX`}),t[17]=u,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(b,{asChild:!0,children:(0,k.jsx)(m,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===f?F=t[23]:(F=e=>f.requestMove(e),t[22]=f,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(g,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==s||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(C,{}),(0,k.jsxs)(y,{onSelect:s,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=s,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(x,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(S,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==f.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,f.dialog]}),t[36]=f.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N as SkillToolbarControls};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./select-Bu4Wm3Rf.js";import{t as m}from"./button-DzgjsZzC.js";import{l as h,n as g,r as _,t as v}from"./AddPropertiesButton-DvtOOL5J.js";import{a as y,h as b,r as x,t as S,u as C}from"./dropdown-menu-DtLu9NwU.js";import{n as w}from"./file-plus-DKxOZh2k.js";import{t as T}from"./list-plus-CYMJBvrm.js";import{p as E,t as D}from"./skill-scope-CxuIje2Y.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:m,triggerClassName:h}=e,{_:g}=i(),_=E(),v;t[0]===a?v=t[1]:(v=e=>a(e),t[0]=a,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`oCHfGC`}),t[2]=g,t[3]=y);let b;t[4]===h?b=t[5]:(b=o(`w-auto gap-1 text-xs font-mono uppercase`,h),t[4]=h,t[5]=b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(f,{}),t[6]=x):x=t[6];let S;t[7]!==y||t[8]!==b?(S=(0,k.jsx)(u,{size:`sm`,"aria-label":y,"data-testid":`skill-level-select`,className:b,children:x}),t[7]=y,t[8]=b,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(s,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===_?w=t[12]:(w=D.map(e=>(0,k.jsx)(c,{value:e,children:_[e]},e)),t[11]=_,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(l,{align:`end`,children:(0,k.jsxs)(d,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==m||t[16]!==v||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(p,{value:n,onValueChange:v,disabled:m,children:[S,T]}),t[15]=m,t[16]=v,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,k.jsx)(h,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:c,problemMessages:l}=e,{_:u}=i(),d;t[0]!==a||t[1]!==n?(d={scope:n,name:a},t[0]=a,t[1]=n,t[2]=d):d=t[2];let f=M(d),p;t[3]!==f.requestMove||t[4]!==n?(p=(0,k.jsx)(A,{value:n,onRequestMove:f.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=f.requestMove,t[4]=n,t[5]=p):p=t[5];let h;t[6]!==a||t[7]!==n?(h=(0,k.jsx)(_,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=h):h=t[8];let E;t[9]!==p||t[10]!==h?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,h]}),t[9]=p,t[10]=h,t[11]=E):E=t[11];let D;t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==o?(D=o?(0,k.jsx)(v,{onAddProperty:s,problemCount:c,problemMessages:l,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=c,t[14]=l,t[15]=o,t[16]=D):D=t[16];let j;t[17]===u?j=t[18]:(j=u({id:`Yzs3QX`}),t[17]=u,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(b,{asChild:!0,children:(0,k.jsx)(m,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===f?F=t[23]:(F=e=>f.requestMove(e),t[22]=f,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(g,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==s||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(C,{}),(0,k.jsxs)(y,{onSelect:s,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=s,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(x,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(S,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==f.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,f.dialog]}),t[36]=f.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N as SkillToolbarControls};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,Gt as r,Ln as i,Mn as a,Z as o,_t as s,bt as c,dn as l,kt as u,qt as ee,un as te,wt as d,yt as f}from"./DocumentContext-DcLfGXeI.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{ht as g}from"./schemas-api-BM3O7zA1.js";import{i as _}from"./use-apply-config-theme-CYFG76sS.js";import{H as ne,I as v,L as re,N as ie,T as ae,b as y,c as oe,n as se,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-C-nEZIsQ.js";import{Gn as fe,S,U as C,a as pe,at as w,i as me,o as he,qn as T,st as E}from"./CodeMirrorPropInput-Cza70VJH.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-Cr0C15nJ.js";import{n as A}from"./perf-DZJpLc5j.js";import{f as ge}from"./config-provider-Cs3B2_OX.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as ye,ot as K,pt as q,st as J,tt as Y,ut as X,v as be,wt as Z}from"./dist-D2SphF3p.js";import{i as xe,t as Se}from"./dist-DseqKdAU.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-DKYEqMZn.js";import{o as De,r as Oe}from"./selection-context-D4kyfjCo.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-DxrbxECW.js";import{l as Me}from"./lint-config-client-C0cPUFg9.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-CzJghaXH.js";import{n as Be,t as Ve}from"./src-CaHEUw28.js";var Q=e(p(),1),He=h();function Ue(){let e=u();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);O.lastIndex=0;for(let e=O.exec(t);e!==null;e=O.exec(t)){let t=e[2];if(!D(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,c=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&D(l)&&n!=null)return r.push(I.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-o)),!1;let u=s.exec(c);if(u)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=c(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(r){let i=r.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){r.preventDefault();let e=u()?.get(a);return e===void 0?d():window.location.hash=n(a,e),!0}let o=r.target?.closest?.(`.cm-skill-path-link`),s=o instanceof HTMLElement?o.dataset.skillPath:void 0;return s===void 0?!1:(r.preventDefault(),window.location.hash=f(t,e,s),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:y(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>w()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=x(e,e=>{e.status===`loaded`&&r(e.findings)}),a=E(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[X(),K(),J(),be(),U(),Y(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),q(),j(),V(),Ne(),ye.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!g.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(g.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=I.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{l(t)}finally{T(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),a=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!a){k(se,{...o,outcome:`no-target`});return}let s=i(n,`outline`,()=>{e.dispatch({selection:Z.cursor(a.from),effects:F.scrollIntoView(a.from,{y:`start`})}),e.focus()});k(se,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);i(r,`raw-mdx`,()=>{e.dispatch({selection:Z.cursor(o),effects:F.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,a=Math.min(Math.max(t.line,1),r.lines),o=r.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return i(n,`problems-row`,()=>{e.dispatch({selection:Z.cursor(s),effects:F.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:i,provider:s,placeholder:c,isSourceModeActive:l}=e,u=(0,Q.useRef)(null),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(null);if(f)throw f;let{resolvedTheme:h}=m(),{merged:g}=_(),y=(0,Q.useRef)(l),b=g?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==g?(S=x?.effective??(g?.contentRules?Ae(g.contentRules):je),t[0]=x?.effective,t[1]=g,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E=(0,Q.useRef)(null),D;t[5]!==n||t[6]!==l||t[7]!==C||t[8]!==c||t[9]!==s||t[10]!==h||t[11]!==b||t[12]!==i?(D=()=>{let e=u.current;if(!e)return;let t=s.configuration.name??``,f,m=zt;try{f=te({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let l=null,u=new ge(i);try{let te=o({ydoc:s.document,ytext:i,docName:t}),d=new N,f=new N,p=new N,g=new N,_=new F({state:_e.create({doc:i.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>a(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),ye.of([xe]),Ve(i,s.awareness,{undoManager:u}),ye.of(Be),kt({docName:t,ytext:i,undoManager:u}),...me({themeCompartment:d,resolvedTheme:h,ydoc:s.document,wordWrapCompartment:f,wordWrap:b,currentDocName:t}),Tt(),Ge(t),ne(),g.of(it(C,n)),rt(n),te,F.updateListener.of(e=>{r(e)&&ee(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(l!==null&&clearTimeout(l),l=setTimeout(()=>{l=null,ue(t,`source`,ae(e.view)),Oe(t,`source`,De(e.view,t))},120))}),p.of(ve(c??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,ae(_)),Oe(t,`source`,De(_,t));let v=_.contentDOM;return v.addEventListener(`keydown`,m),v.addEventListener(`paste`,m),v.addEventListener(`drop`,m),v.addEventListener(`cut`,m),{view:_,ydoc:s.document,ytext:i,provider:s,undoManager:u,themeCompartment:d,wordWrapCompartment:f,placeholderCompartment:p,lintCompartment:g}}catch(e){let t=e;throw u.destroy(),t}}}),E.current=f,d.current=f.view,At(f.view,l),fe(n,f.view,`sourceEditor`),le()&&f.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,d.current=null,p(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,d.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=l,t[7]=C,t[8]=c,t[9]=s,t[10]=h,t[11]=b,t[12]=i,t[13]=D):D=t[13];let O;t[14]!==s||t[15]!==i?(O=[i,s],t[14]=s,t[15]=i,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===l?(A=t[18],j=t[19]):(A=()=>{y.current=l;let e=d.current;e&&At(e,l)},j=[l],t[17]=l,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===n?(M=t[21],P=t[22]):(M=()=>{},P=[n],t[20]=n,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===h?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(h===`dark`?pe:he)})},I=[h],t[23]=h,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===b?(R=t[27],z=t[28]):(R=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?F.lineWrapping:[])})},z=[b],t[26]=b,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===c?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(c??``))})},V=[c],t[29]=c,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==n||t[33]!==C?(H=()=>{let e=E.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(C,n))})},t[32]=n,t[33]=C,t[34]=H):H=t[34];let U;t[35]===T?U=t[36]:(U=[T],t[35]=T,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==n||t[38]!==l?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!l)return;let r=d.current;if(!r){k(se,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),v(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,l],t[37]=n,t[38]=l,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let K,q;t[41]!==n||t[42]!==l?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!l)return;let r=d.current;r&&It(r,t,n)&&v(n)};return window.addEventListener(oe,e),()=>window.removeEventListener(oe,e)},q=[n,l],t[41]=n,t[42]=l,t[43]=K,t[44]=q):(K=t[43],q=t[44]),(0,Q.useEffect)(K,q);let J,Y;t[45]!==n||t[46]!==l||t[47]!==s?(J=()=>{if(!l)return;let e=d.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){re(n),t.kind===`outline`?Pt(e,t.detail,n):t.kind===`lint`?It(e,t.detail,n):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(i=ie({view:e,docName:n,navigation:t,ydoc:s.document,transition:{from:`wysiwyg`,to:`source`}}),i&&re(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},Y=[n,l,s],t[45]=n,t[46]=l,t[47]=s,t[48]=J,t[49]=Y):(J=t[48],Y=t[49]),(0,Q.useEffect)(J,Y);let X;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,jt.jsx)(`div`,{ref:u,className:`source-editor h-full pb-3`}),t[50]=X):X=t[50],X}function Rt(){return{top:S()}}function zt(){return C()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,Gt as r,Ln as i,Mn as a,Z as o,_t as s,bt as c,dn as l,kt as u,qt as ee,un as te,wt as d,yt as f}from"./DocumentContext-Cgpe7PUq.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{ht as g}from"./schemas-api-BM3O7zA1.js";import{i as _}from"./use-apply-config-theme-CYFG76sS.js";import{H as ne,I as v,L as re,N as ie,T as ae,b as y,c as oe,n as se,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-BKuWOIaA.js";import{Gn as fe,S,U as C,a as pe,at as w,i as me,o as he,qn as T,st as E}from"./CodeMirrorPropInput-BTCkQ8gy.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-Cr0C15nJ.js";import{n as A}from"./perf-DZJpLc5j.js";import{f as ge}from"./config-provider-DBgrt1kx.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as ye,ot as K,pt as q,st as J,tt as Y,ut as X,v as be,wt as Z}from"./dist-D2SphF3p.js";import{i as xe,t as Se}from"./dist-DseqKdAU.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-DKYEqMZn.js";import{o as De,r as Oe}from"./selection-context-C68gF2Oq.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-DxrbxECW.js";import{l as Me}from"./lint-config-client-C0cPUFg9.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-CzJghaXH.js";import{n as Be,t as Ve}from"./src-COG_7U42.js";var Q=e(p(),1),He=h();function Ue(){let e=u();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);O.lastIndex=0;for(let e=O.exec(t);e!==null;e=O.exec(t)){let t=e[2];if(!D(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,c=i.slice(a,i.length-o),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&D(l)&&n!=null)return r.push(I.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-o)),!1;let u=s.exec(c);if(u)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=c(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(r){let i=r.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){r.preventDefault();let e=u()?.get(a);return e===void 0?d():window.location.hash=n(a,e),!0}let o=r.target?.closest?.(`.cm-skill-path-link`),s=o instanceof HTMLElement?o.dataset.skillPath:void 0;return s===void 0?!1:(r.preventDefault(),window.location.hash=f(t,e,s),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:y(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>w()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=x(e,e=>{e.status===`loaded`&&r(e.findings)}),a=E(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[X(),K(),J(),be(),U(),Y(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),q(),j(),V(),Ne(),ye.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!g.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(g.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=I.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{l(t)}finally{T(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),a=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!a){k(se,{...o,outcome:`no-target`});return}let s=i(n,`outline`,()=>{e.dispatch({selection:Z.cursor(a.from),effects:F.scrollIntoView(a.from,{y:`start`})}),e.focus()});k(se,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);i(r,`raw-mdx`,()=>{e.dispatch({selection:Z.cursor(o),effects:F.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,a=Math.min(Math.max(t.line,1),r.lines),o=r.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return i(n,`problems-row`,()=>{e.dispatch({selection:Z.cursor(s),effects:F.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:i,provider:s,placeholder:c,isSourceModeActive:l}=e,u=(0,Q.useRef)(null),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(null);if(f)throw f;let{resolvedTheme:h}=m(),{merged:g}=_(),y=(0,Q.useRef)(l),b=g?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==g?(S=x?.effective??(g?.contentRules?Ae(g.contentRules):je),t[0]=x?.effective,t[1]=g,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E=(0,Q.useRef)(null),D;t[5]!==n||t[6]!==l||t[7]!==C||t[8]!==c||t[9]!==s||t[10]!==h||t[11]!==b||t[12]!==i?(D=()=>{let e=u.current;if(!e)return;let t=s.configuration.name??``,f,m=zt;try{f=te({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let l=null,u=new ge(i);try{let te=o({ydoc:s.document,ytext:i,docName:t}),d=new N,f=new N,p=new N,g=new N,_=new F({state:_e.create({doc:i.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>a(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),ye.of([xe]),Ve(i,s.awareness,{undoManager:u}),ye.of(Be),kt({docName:t,ytext:i,undoManager:u}),...me({themeCompartment:d,resolvedTheme:h,ydoc:s.document,wordWrapCompartment:f,wordWrap:b,currentDocName:t}),Tt(),Ge(t),ne(),g.of(it(C,n)),rt(n),te,F.updateListener.of(e=>{r(e)&&ee(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(l!==null&&clearTimeout(l),l=setTimeout(()=>{l=null,ue(t,`source`,ae(e.view)),Oe(t,`source`,De(e.view,t))},120))}),p.of(ve(c??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,ae(_)),Oe(t,`source`,De(_,t));let v=_.contentDOM;return v.addEventListener(`keydown`,m),v.addEventListener(`paste`,m),v.addEventListener(`drop`,m),v.addEventListener(`cut`,m),{view:_,ydoc:s.document,ytext:i,provider:s,undoManager:u,themeCompartment:d,wordWrapCompartment:f,placeholderCompartment:p,lintCompartment:g}}catch(e){let t=e;throw u.destroy(),t}}}),E.current=f,d.current=f.view,At(f.view,l),fe(n,f.view,`sourceEditor`),le()&&f.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,d.current=null,p(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,d.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=l,t[7]=C,t[8]=c,t[9]=s,t[10]=h,t[11]=b,t[12]=i,t[13]=D):D=t[13];let O;t[14]!==s||t[15]!==i?(O=[i,s],t[14]=s,t[15]=i,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===l?(A=t[18],j=t[19]):(A=()=>{y.current=l;let e=d.current;e&&At(e,l)},j=[l],t[17]=l,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===n?(M=t[21],P=t[22]):(M=()=>{},P=[n],t[20]=n,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===h?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(h===`dark`?pe:he)})},I=[h],t[23]=h,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===b?(R=t[27],z=t[28]):(R=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?F.lineWrapping:[])})},z=[b],t[26]=b,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===c?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(c??``))})},V=[c],t[29]=c,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==n||t[33]!==C?(H=()=>{let e=E.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(C,n))})},t[32]=n,t[33]=C,t[34]=H):H=t[34];let U;t[35]===T?U=t[36]:(U=[T],t[35]=T,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==n||t[38]!==l?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!l)return;let r=d.current;if(!r){k(se,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n),v(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,l],t[37]=n,t[38]=l,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let K,q;t[41]!==n||t[42]!==l?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!l)return;let r=d.current;r&&It(r,t,n)&&v(n)};return window.addEventListener(oe,e),()=>window.removeEventListener(oe,e)},q=[n,l],t[41]=n,t[42]=l,t[43]=K,t[44]=q):(K=t[43],q=t[44]),(0,Q.useEffect)(K,q);let J,Y;t[45]!==n||t[46]!==l||t[47]!==s?(J=()=>{if(!l)return;let e=d.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){re(n),t.kind===`outline`?Pt(e,t.detail,n):t.kind===`lint`?It(e,t.detail,n):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(i=ie({view:e,docName:n,navigation:t,ydoc:s.document,transition:{from:`wysiwyg`,to:`source`}}),i&&re(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},Y=[n,l,s],t[45]=n,t[46]=l,t[47]=s,t[48]=J,t[49]=Y):(J=t[48],Y=t[49]),(0,Q.useEffect)(J,Y);let X;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,jt.jsx)(`div`,{ref:u,className:`source-editor h-full pb-3`}),t[50]=X):X=t[50],X}function Rt(){return{top:S()}}function zt(){return C()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
@@ -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{i as o,n as s,t as c}from"./tooltip-DBqLYfio.js";import{n as ee,r as te,t as ne}from"./collapsible-BKbszYZV.js";import{i as l,n as u,o as d,s as f,t as re}from"./select-Bu4Wm3Rf.js";import{n as p,t as ie}from"./toggle-group-B7p69Qfd.js";import{t as m}from"./button-DzgjsZzC.js";import{n as ae}from"./dist-BGzUo_18.js";import{d as oe,f as se,h as ce,m as le,p as ue}from"./share-D-LUU2aX-DfD-mrg-.js";import{i as de}from"./use-apply-config-theme-CYFG76sS.js";import{C as fe,S as pe,a as me,b as he,c as ge,h as _e,l as ve,m as ye,n as be,o as xe,p as Se,t as Ce,u as we,w as Te}from"./SyncStatusBadge-CrhgKvf8.js";import{t as Ee}from"./arrow-up-right-nJaICi16.js";import{t as De}from"./chevron-right-Bofu4lib.js";import{n as Oe}from"./use-settings-route-DT86DJkF.js";import"./config-provider-Cs3B2_OX.js";import{t as ke}from"./use-git-sync-status-BQYF2F5Z.js";import{t as Ae}from"./AuthModal-CkHLmy_N.js";import{t as h}from"./PublishToGitHubDialog-BD0FxuNe.js";import{n as je,t as Me}from"./SettingsSectionHeader-XnGFBVeB.js";var Ne=a(),g=e(n(),1),_=t(),v=`data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90`;function y(){let e=(0,Ne.c)(4),[t,n]=(0,g.useState)(!1),r=(0,g.useRef)(null),i=(0,g.useRef)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,_.jsx)(Pe,{onPublish:()=>n(!0),setUpSyncingRef:r}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(r.current??i.current)?.focus(),e[1]=o):o=e[1];let s;return e[2]===t?s=e[3]:(s=(0,_.jsxs)(`section`,{ref:i,"aria-labelledby":`settings-sync-title`,tabIndex:-1,"data-testid":`settings-sync-section`,children:[a,(0,_.jsx)(h,{open:t,onOpenChange:n,returnFocus:o})]}),e[2]=t,e[3]=s),s}function Pe(e){let t=(0,Ne.c)(120),{onPublish:n,setUpSyncingRef:a}=e,{_:h}=i(),y=ke(),{projectConfig:Pe,projectLocalConfig:Le,projectLocalSynced:Re,projectSynced:ze}=de(),Be=Te(),Ve=he(),He=pe(),[Ue,We]=(0,g.useState)(!1),Ge,Ke;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=()=>{Oe()&&We(!0)},Ke=[],t[0]=Ge,t[1]=Ke):(Ge=t[0],Ke=t[1]),(0,g.useEffect)(Ge,Ke);let b=le(Le?.autoSync),qe=b.pushIntervalSeconds<b.pullIntervalSeconds,Je;t[2]===Le?.autoSync?Je=t[3]:(Je=ce(Le?.autoSync)??`off`,t[2]=Le?.autoSync,t[3]=Je);let x=Je,{confirmOpen:Ye,setConfirmOpen:Xe,pendingMode:Ze,onModeSelect:S,onConfirm:Qe}=fe(Be,x),[$e,C]=(0,g.useState)(!1);if(y&&!y.hasRemote&&y.state===`dormant`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,_.jsx)(r,{id:`Nu4DdT`}),t[4]=e):e=t[4];let i;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,_.jsx)(Me,{titleId:`settings-sync-title`,title:e,scope:`project-local`,level:`block`,children:(0,_.jsx)(r,{id:`AiNMQ7`})}),t[5]=i):i=t[5];let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,_.jsx)(`div`,{className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`3_6U6f`})}),t[6]=o):o=t[6];let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,_.jsxs)(`div`,{className:`space-y-0.5`,children:[o,(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,_.jsx)(r,{id:`i92eAT`})})]}),t[7]=s):s=t[7];let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,_.jsx)(r,{id:`zkz0Fg`}),t[8]=c):c=t[8];let l;t[9]!==n||t[10]!==a?(l=(0,_.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[s,(0,_.jsx)(m,{ref:a,onClick:n,"data-testid":`settings-sync-setup`,children:c})]}),t[9]=n,t[10]=a,t[11]=l):l=t[11];let u;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,_.jsx)(te,{asChild:!0,children:(0,_.jsxs)(m,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,children:[(0,_.jsx)(De,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`6caB2T`})]})}),t[12]=u):u=t[12];let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,_.jsxs)(ne,{children:[u,(0,_.jsx)(ee,{className:`px-1.5 pt-2 text-sm text-muted-foreground`,children:(0,_.jsx)(r,{id:`44DSl0`,components:{0:(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[13]=d):d=t[13];let f;return t[14]===l?f=t[15]:(f=(0,_.jsxs)(`div`,{className:`space-y-4`,"data-testid":`settings-sync-empty`,children:[i,l,d]}),t[14]=l,t[15]=f),f}let et=!Re,w=y?.pushPermission?.checkStatus===`denied`||y?.pausedReason===`no-push-permission`,tt=y?.pushPermission,T;t[16]===tt?T=t[17]:(T=Se(tt),t[16]=tt,t[17]=T);let nt=T,E;t[18]===y?E=t[19]:(E=y!==null&&ge(y),t[18]=y,t[19]=E);let rt=E,D=x===`full`&&w&&nt,O=x===`full`&&w&&!nt&&!rt,k=!O&&!D&&w&&!rt,it=y?.pushPermission?.checkStatus===`denied`&&y.pushPermission.deniedReason!==`not-authenticated`&&!rt,at;t[20]===y?at=t[21]:(at=we(y),t[20]=y,t[21]=at);let A=at,ot=w&&y?.pausedReason!==`unsafe-incoming-symlinks`,st;t[22]!==A||t[23]!==ot||t[24]!==y?(st=y?.pausedReason?A?xe(`auth-not-found-as-identity`,ve(y?.remote)):ot?null:(0,_.jsx)(Ce,{reason:y.pausedReason}):null,t[22]=A,t[23]=ot,t[24]=y,t[25]=st):st=t[25];let j=st,ct;t[26]===S?ct=t[27]:(ct=function(e){se(e)&&S(e)},t[26]=S,t[27]=ct);let lt=ct,ut;t[28]===Pe?.autoSync?.default?ut=t[29]:(ut=ue(Pe?.autoSync?.default)??`ask`,t[28]=Pe?.autoSync?.default,t[29]=ut);let dt=ut,ft;t[30]!==h||t[31]!==Ve?(ft=function(e){if(e!==`ask`&&!se(e))return;if(Ve===null){ae.error(h({id:`fiMNLl`}));return}let t;bb151:switch(e){case`ask`:t=null;break bb151;case`off`:t=!1;break bb151;case`full`:t=!0;break bb151;case`follow`:t=`follow`;break bb151;default:throw Error(`unhandled committed default: ${String(e)}`)}let n=Ve(t);if(!n.ok){let e=n.error;ae.error(h({id:`oAFVKX`,values:{detail:e}}))}},t[30]=h,t[31]=Ve,t[32]=ft):ft=t[32];let pt=ft,mt;t[33]===h?mt=t[34]:(mt=function(e){switch(e){case 30:return h({id:`OqqecQ`});case 60:return h({id:`4mbrAq`});case 300:return h({id:`PEGxvo`});case 900:return h({id:`Cz-K13`});case 3600:return h({id:`vp5vfW`});default:return h({id:`U7Iesw`,values:{seconds:e}})}},t[33]=h,t[34]=mt);let ht=mt,gt;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(gt=function(e){return oe.includes(e)?[...oe]:[...oe,e].sort(Ie)},t[35]=gt):gt=t[35];let _t=gt,vt=function(e,t){let n=Number(t);if(!Number.isFinite(n)||He===null)return;let r=He({pullIntervalSeconds:e===`pull`?n:b.pullIntervalSeconds,pushIntervalSeconds:e===`push`?n:b.pushIntervalSeconds});if(!r.ok){let e=r.error;ae.error(h({id:`WOfp4H`,values:{detail:e}}))}},yt;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,_.jsx)(r,{id:`Nu4DdT`}),t[36]=yt):yt=t[36];let M;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,_.jsx)(Me,{titleId:`settings-sync-title`,title:yt,scope:`project-local`,level:`block`,children:(0,_.jsx)(r,{id:`qLXJTB`})}),t[37]=M):M=t[37];let bt;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,_.jsx)(`div`,{id:`settings-sync-mode-label`,className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`yZepkk`})}),t[38]=bt):bt=t[38];let N;t[39]===x?N=t[40]:(N=(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-body`,children:x===`full`?(0,_.jsx)(r,{id:`zBiFZh`}):x===`follow`?(0,_.jsx)(r,{id:`PGRnbw`}):(0,_.jsx)(r,{id:`t5I7P_`})}),t[39]=x,t[40]=N);let P;t[41]!==h||t[42]!==y?(P=y?.remote?(0,_.jsxs)(`p`,{className:`text-muted-foreground text-1sm truncate`,"data-testid":`settings-sync-remote`,children:[(0,_.jsx)(r,{id:`Q8A-U_`}),` `,y.remote.webUrl?(0,_.jsxs)(`a`,{href:y.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5`,"aria-label":h({id:`1nke1r`,values:{0:y.remote.label}}),"data-testid":`settings-sync-remote-link`,children:[(0,_.jsx)(`span`,{children:y.remote.label}),(0,_.jsx)(Ee,{className:`inline size-3.5`,"aria-hidden":!0})]}):(0,_.jsx)(`span`,{className:`font-medium text-foreground`,"data-testid":`settings-sync-remote-label`,children:y.remote.label})]}):null,t[41]=h,t[42]=y,t[43]=P):P=t[43];let F;t[44]!==N||t[45]!==P?(F=(0,_.jsxs)(`div`,{className:`min-w-0`,children:[bt,N,P]}),t[44]=N,t[45]=P,t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,_.jsx)(p,{value:`off`,className:v,"data-testid":`settings-sync-mode-off`,children:(0,_.jsx)(r,{id:`BWTzAb`})}),t[47]=I):I=t[47];let L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,_.jsx)(p,{value:`follow`,className:v,"data-testid":`settings-sync-mode-follow`,children:(0,_.jsx)(r,{id:`tlGXxX`})}),t[48]=L):L=t[48];let R;t[49]!==it||t[50]!==k?(R=it?(0,_.jsxs)(c,{children:[(0,_.jsx)(o,{asChild:!0,children:(0,_.jsx)(`span`,{className:`inline-flex`,children:(0,_.jsx)(p,{value:`full`,className:v,disabled:!0,"aria-describedby":k?`settings-sync-denied-hint-text`:void 0,"data-testid":`settings-sync-mode-full`,children:(0,_.jsx)(r,{id:`IXiG0B`})})})}),(0,_.jsx)(s,{"data-testid":`settings-sync-mode-full-tip`,children:(0,_.jsx)(r,{id:`EiVgl5`})})]}):(0,_.jsx)(p,{value:`full`,className:v,"data-testid":`settings-sync-mode-full`,children:(0,_.jsx)(r,{id:`IXiG0B`})}),t[49]=it,t[50]=k,t[51]=R):R=t[51];let z;t[52]!==x||t[53]!==et||t[54]!==lt||t[55]!==R?(z=(0,_.jsxs)(ie,{type:`single`,variant:`outline`,spacing:2,value:x,onValueChange:lt,disabled:et,"aria-labelledby":`settings-sync-mode-label`,"data-testid":`settings-sync-mode-toggle`,children:[I,L,R]}),t[52]=x,t[53]=et,t[54]=lt,t[55]=R,t[56]=z):z=t[56];let B;t[57]!==F||t[58]!==z?(B=(0,_.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[F,z]}),t[57]=F,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==C||t[61]!==D?(V=D&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-reconnect`,children:[(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,_.jsx)(r,{id:`tnG-m6`})}),(0,_.jsx)(m,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>C(!0),children:(0,_.jsx)(r,{id:`5lWFkC`})})]}),t[60]=C,t[61]=D,t[62]=V):V=t[62];let H;t[63]!==S||t[64]!==O?(H=O&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-switch-follow`,children:[(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,_.jsx)(r,{id:`srdlOs`})}),(0,_.jsx)(m,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>S(`follow`),"data-testid":`settings-sync-switch-follow-action`,children:(0,_.jsx)(r,{id:`v16Pzh`})})]}),t[63]=S,t[64]=O,t[65]=H):H=t[65];let U;t[66]!==x||t[67]!==k?(U=k&&(0,_.jsx)(`p`,{id:`settings-sync-denied-hint-text`,className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-denied-hint`,children:x===`follow`?(0,_.jsx)(r,{id:`EiVgl5`}):(0,_.jsx)(r,{id:`eNOyTV`})}),t[66]=x,t[67]=k,t[68]=U):U=t[68];let W;t[69]===j?W=t[70]:(W=j!==null&&(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-reason`,children:j}),t[69]=j,t[70]=W);let G;t[71]!==j||t[72]!==y?.refusedSymlinkPaths?(G=j!==null&&(y?.refusedSymlinkPaths?.length??0)>0&&(0,_.jsx)(`div`,{className:`mt-2`,children:(0,_.jsx)(be,{paths:y?.refusedSymlinkPaths})}),t[71]=j,t[72]=y?.refusedSymlinkPaths,t[73]=G):G=t[73];let K;t[74]!==A||t[75]!==k||t[76]!==O||t[77]!==y?(K=y?.pushPermission?.checkStatus===`denied`&&(A||O||k)?(0,_.jsx)(`div`,{className:`mt-2 space-y-1`,"data-testid":`settings-sync-identity`,children:me(y.pushPermission).map(Fe)}):null,t[74]=A,t[75]=k,t[76]=O,t[77]=y,t[78]=K):K=t[78];let q;t[79]!==C||t[80]!==y?.pushPermission?(q=ye(y?.pushPermission)&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-signin-again`,children:[(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,_.jsx)(r,{id:`C_cPoW`})}),(0,_.jsx)(m,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>C(!0),children:(0,_.jsx)(r,{id:`5lWFkC`})})]}),t[79]=C,t[80]=y?.pushPermission,t[81]=q):q=t[81];let J;t[82]!==B||t[83]!==V||t[84]!==H||t[85]!==U||t[86]!==W||t[87]!==G||t[88]!==K||t[89]!==q?(J=(0,_.jsxs)(`div`,{className:`rounded-md border p-3`,children:[B,V,H,U,W,G,K,q]}),t[82]=B,t[83]=V,t[84]=H,t[85]=U,t[86]=W,t[87]=G,t[88]=K,t[89]=q,t[90]=J):J=t[90];let xt=x!==`off`&&(0,_.jsxs)(ne,{open:Ue,onOpenChange:We,children:[(0,_.jsx)(te,{asChild:!0,children:(0,_.jsxs)(m,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,"data-testid":`settings-sync-advanced-trigger`,children:[(0,_.jsx)(De,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`sxkWRg`})]})}),(0,_.jsx)(ee,{className:`pt-2`,children:(0,_.jsxs)(`div`,{className:`rounded-md border p-3 space-y-3`,"data-testid":`settings-sync-intervals`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{id:`settings-sync-pull-interval-label`,className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`Xs1kjx`})}),(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,_.jsx)(r,{id:`T1fMJ6`})})]}),(0,_.jsxs)(re,{value:String(b.pullIntervalSeconds),onValueChange:e=>vt(`pull`,e),disabled:!Re,children:[(0,_.jsx)(d,{size:`sm`,className:`w-40 shrink-0`,"aria-labelledby":`settings-sync-pull-interval-label`,"data-testid":`settings-sync-pull-interval`,children:(0,_.jsx)(f,{})}),(0,_.jsx)(u,{children:_t(b.pullIntervalSeconds).map(e=>(0,_.jsx)(l,{value:String(e),children:ht(e)},e))})]})]}),x===`full`&&(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-t pt-3`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{id:`settings-sync-push-interval-label`,className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`gyYvCN`})}),(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,_.jsx)(r,{id:`czQDKY`})})]}),(0,_.jsxs)(re,{value:String(b.pushIntervalSeconds),onValueChange:e=>vt(`push`,e),disabled:!Re,children:[(0,_.jsx)(d,{size:`sm`,className:`w-40 shrink-0`,"aria-labelledby":`settings-sync-push-interval-label`,"data-testid":`settings-sync-push-interval`,children:(0,_.jsx)(f,{})}),(0,_.jsx)(u,{children:_t(b.pushIntervalSeconds).map(e=>(0,_.jsx)(l,{value:String(e),children:ht(e)},e))})]})]}),x===`full`&&qe&&(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-sync-push-outpaces-pull-hint`,children:(0,_.jsx)(r,{id:`x-E_vF`})})]})})]}),St;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(St=(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`div`,{id:`settings-sync-default-label`,className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`j_Z6g7`})}),(0,_.jsx)(je,{scope:`project`})]}),t[91]=St):St=t[91];let Ct;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,_.jsxs)(`div`,{className:`space-y-0.5`,children:[St,(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,_.jsx)(r,{id:`msuDyW`})})]}),t[92]=Ct):Ct=t[92];let wt=!ze,Tt;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=(0,_.jsx)(p,{value:`ask`,className:v,"data-testid":`settings-sync-default-ask`,children:(0,_.jsx)(r,{id:`EdQY6l`})}),t[93]=Tt):Tt=t[93];let Et;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,_.jsx)(p,{value:`off`,className:v,"data-testid":`settings-sync-default-off`,children:(0,_.jsx)(r,{id:`BWTzAb`})}),t[94]=Et):Et=t[94];let Y;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,_.jsx)(p,{value:`follow`,className:v,"data-testid":`settings-sync-default-follow`,children:(0,_.jsx)(r,{id:`tlGXxX`})}),t[95]=Y):Y=t[95];let Dt;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,_.jsx)(p,{value:`full`,className:v,"data-testid":`settings-sync-default-full`,children:(0,_.jsx)(r,{id:`IXiG0B`})}),t[96]=Dt):Dt=t[96];let X;t[97]!==dt||t[98]!==pt||t[99]!==wt?(X=(0,_.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,"data-testid":`settings-sync-default`,children:[Ct,(0,_.jsxs)(ie,{type:`single`,variant:`outline`,spacing:2,value:dt,onValueChange:pt,disabled:wt,"aria-labelledby":`settings-sync-default-label`,"data-testid":`settings-sync-default-toggle`,children:[Tt,Et,Y,Dt]})]}),t[97]=dt,t[98]=pt,t[99]=wt,t[100]=X):X=t[100];let Ot=Ze??`full`,kt=Ze===`follow`?y?.ahead??0:0,Z;t[101]!==Ye||t[102]!==Qe||t[103]!==Xe||t[104]!==Ot||t[105]!==kt?(Z=(0,_.jsx)(_e,{open:Ye,onOpenChange:Xe,onConfirm:Qe,variant:Ot,strandedCommitCount:kt}),t[101]=Ye,t[102]=Qe,t[103]=Xe,t[104]=Ot,t[105]=kt,t[106]=Z):Z=t[106];let Q;t[107]===C?Q=t[108]:(Q=()=>C(!1),t[107]=C,t[108]=Q);let $;t[109]!==$e||t[110]!==C||t[111]!==Q?($=(0,_.jsx)(Ae,{open:$e,onOpenChange:C,onSuccess:Q,reauth:!0}),t[109]=$e,t[110]=C,t[111]=Q,t[112]=$):$=t[112];let At;return t[113]!==M||t[114]!==J||t[115]!==xt||t[116]!==X||t[117]!==Z||t[118]!==$?(At=(0,_.jsxs)(`div`,{className:`space-y-3`,children:[M,J,xt,X,Z,$]}),t[113]=M,t[114]=J,t[115]=xt,t[116]=X,t[117]=Z,t[118]=$,t[119]=At):At=t[119],At}function Fe(e){return(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:e},e)}function Ie(e,t){return e-t}export{y as SyncSection};
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{i as o,n as s,t as c}from"./tooltip-DBqLYfio.js";import{n as ee,r as te,t as ne}from"./collapsible-BKbszYZV.js";import{i as l,n as u,o as d,s as f,t as re}from"./select-Bu4Wm3Rf.js";import{n as p,t as ie}from"./toggle-group-B7p69Qfd.js";import{t as m}from"./button-DzgjsZzC.js";import{n as ae}from"./dist-BGzUo_18.js";import{d as oe,f as se,h as ce,m as le,p as ue}from"./share-D-LUU2aX-DfD-mrg-.js";import{i as de}from"./use-apply-config-theme-CYFG76sS.js";import{C as fe,S as pe,a as me,b as he,c as ge,h as _e,l as ve,m as ye,n as be,o as xe,p as Se,t as Ce,u as we,w as Te}from"./SyncStatusBadge-7CGaFHUk.js";import{t as Ee}from"./arrow-up-right-nJaICi16.js";import{t as De}from"./chevron-right-Bofu4lib.js";import{n as Oe}from"./use-settings-route-DT86DJkF.js";import"./config-provider-DBgrt1kx.js";import{t as ke}from"./use-git-sync-status-BQYF2F5Z.js";import{t as Ae}from"./AuthModal-CkHLmy_N.js";import{t as h}from"./PublishToGitHubDialog-BcpO5RKl.js";import{n as je,t as Me}from"./SettingsSectionHeader-XnGFBVeB.js";var Ne=a(),g=e(n(),1),_=t(),v=`data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90`;function y(){let e=(0,Ne.c)(4),[t,n]=(0,g.useState)(!1),r=(0,g.useRef)(null),i=(0,g.useRef)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,_.jsx)(Pe,{onPublish:()=>n(!0),setUpSyncingRef:r}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(r.current??i.current)?.focus(),e[1]=o):o=e[1];let s;return e[2]===t?s=e[3]:(s=(0,_.jsxs)(`section`,{ref:i,"aria-labelledby":`settings-sync-title`,tabIndex:-1,"data-testid":`settings-sync-section`,children:[a,(0,_.jsx)(h,{open:t,onOpenChange:n,returnFocus:o})]}),e[2]=t,e[3]=s),s}function Pe(e){let t=(0,Ne.c)(120),{onPublish:n,setUpSyncingRef:a}=e,{_:h}=i(),y=ke(),{projectConfig:Pe,projectLocalConfig:Le,projectLocalSynced:Re,projectSynced:ze}=de(),Be=Te(),Ve=he(),He=pe(),[Ue,We]=(0,g.useState)(!1),Ge,Ke;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=()=>{Oe()&&We(!0)},Ke=[],t[0]=Ge,t[1]=Ke):(Ge=t[0],Ke=t[1]),(0,g.useEffect)(Ge,Ke);let b=le(Le?.autoSync),qe=b.pushIntervalSeconds<b.pullIntervalSeconds,Je;t[2]===Le?.autoSync?Je=t[3]:(Je=ce(Le?.autoSync)??`off`,t[2]=Le?.autoSync,t[3]=Je);let x=Je,{confirmOpen:Ye,setConfirmOpen:Xe,pendingMode:Ze,onModeSelect:S,onConfirm:Qe}=fe(Be,x),[$e,C]=(0,g.useState)(!1);if(y&&!y.hasRemote&&y.state===`dormant`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,_.jsx)(r,{id:`Nu4DdT`}),t[4]=e):e=t[4];let i;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,_.jsx)(Me,{titleId:`settings-sync-title`,title:e,scope:`project-local`,level:`block`,children:(0,_.jsx)(r,{id:`AiNMQ7`})}),t[5]=i):i=t[5];let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,_.jsx)(`div`,{className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`3_6U6f`})}),t[6]=o):o=t[6];let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,_.jsxs)(`div`,{className:`space-y-0.5`,children:[o,(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,_.jsx)(r,{id:`i92eAT`})})]}),t[7]=s):s=t[7];let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,_.jsx)(r,{id:`zkz0Fg`}),t[8]=c):c=t[8];let l;t[9]!==n||t[10]!==a?(l=(0,_.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[s,(0,_.jsx)(m,{ref:a,onClick:n,"data-testid":`settings-sync-setup`,children:c})]}),t[9]=n,t[10]=a,t[11]=l):l=t[11];let u;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,_.jsx)(te,{asChild:!0,children:(0,_.jsxs)(m,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,children:[(0,_.jsx)(De,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`6caB2T`})]})}),t[12]=u):u=t[12];let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,_.jsxs)(ne,{children:[u,(0,_.jsx)(ee,{className:`px-1.5 pt-2 text-sm text-muted-foreground`,children:(0,_.jsx)(r,{id:`44DSl0`,components:{0:(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[13]=d):d=t[13];let f;return t[14]===l?f=t[15]:(f=(0,_.jsxs)(`div`,{className:`space-y-4`,"data-testid":`settings-sync-empty`,children:[i,l,d]}),t[14]=l,t[15]=f),f}let et=!Re,w=y?.pushPermission?.checkStatus===`denied`||y?.pausedReason===`no-push-permission`,tt=y?.pushPermission,T;t[16]===tt?T=t[17]:(T=Se(tt),t[16]=tt,t[17]=T);let nt=T,E;t[18]===y?E=t[19]:(E=y!==null&&ge(y),t[18]=y,t[19]=E);let rt=E,D=x===`full`&&w&&nt,O=x===`full`&&w&&!nt&&!rt,k=!O&&!D&&w&&!rt,it=y?.pushPermission?.checkStatus===`denied`&&y.pushPermission.deniedReason!==`not-authenticated`&&!rt,at;t[20]===y?at=t[21]:(at=we(y),t[20]=y,t[21]=at);let A=at,ot=w&&y?.pausedReason!==`unsafe-incoming-symlinks`,st;t[22]!==A||t[23]!==ot||t[24]!==y?(st=y?.pausedReason?A?xe(`auth-not-found-as-identity`,ve(y?.remote)):ot?null:(0,_.jsx)(Ce,{reason:y.pausedReason}):null,t[22]=A,t[23]=ot,t[24]=y,t[25]=st):st=t[25];let j=st,ct;t[26]===S?ct=t[27]:(ct=function(e){se(e)&&S(e)},t[26]=S,t[27]=ct);let lt=ct,ut;t[28]===Pe?.autoSync?.default?ut=t[29]:(ut=ue(Pe?.autoSync?.default)??`ask`,t[28]=Pe?.autoSync?.default,t[29]=ut);let dt=ut,ft;t[30]!==h||t[31]!==Ve?(ft=function(e){if(e!==`ask`&&!se(e))return;if(Ve===null){ae.error(h({id:`fiMNLl`}));return}let t;bb151:switch(e){case`ask`:t=null;break bb151;case`off`:t=!1;break bb151;case`full`:t=!0;break bb151;case`follow`:t=`follow`;break bb151;default:throw Error(`unhandled committed default: ${String(e)}`)}let n=Ve(t);if(!n.ok){let e=n.error;ae.error(h({id:`oAFVKX`,values:{detail:e}}))}},t[30]=h,t[31]=Ve,t[32]=ft):ft=t[32];let pt=ft,mt;t[33]===h?mt=t[34]:(mt=function(e){switch(e){case 30:return h({id:`OqqecQ`});case 60:return h({id:`4mbrAq`});case 300:return h({id:`PEGxvo`});case 900:return h({id:`Cz-K13`});case 3600:return h({id:`vp5vfW`});default:return h({id:`U7Iesw`,values:{seconds:e}})}},t[33]=h,t[34]=mt);let ht=mt,gt;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(gt=function(e){return oe.includes(e)?[...oe]:[...oe,e].sort(Ie)},t[35]=gt):gt=t[35];let _t=gt,vt=function(e,t){let n=Number(t);if(!Number.isFinite(n)||He===null)return;let r=He({pullIntervalSeconds:e===`pull`?n:b.pullIntervalSeconds,pushIntervalSeconds:e===`push`?n:b.pushIntervalSeconds});if(!r.ok){let e=r.error;ae.error(h({id:`WOfp4H`,values:{detail:e}}))}},yt;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,_.jsx)(r,{id:`Nu4DdT`}),t[36]=yt):yt=t[36];let M;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,_.jsx)(Me,{titleId:`settings-sync-title`,title:yt,scope:`project-local`,level:`block`,children:(0,_.jsx)(r,{id:`qLXJTB`})}),t[37]=M):M=t[37];let bt;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,_.jsx)(`div`,{id:`settings-sync-mode-label`,className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`yZepkk`})}),t[38]=bt):bt=t[38];let N;t[39]===x?N=t[40]:(N=(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-body`,children:x===`full`?(0,_.jsx)(r,{id:`zBiFZh`}):x===`follow`?(0,_.jsx)(r,{id:`PGRnbw`}):(0,_.jsx)(r,{id:`t5I7P_`})}),t[39]=x,t[40]=N);let P;t[41]!==h||t[42]!==y?(P=y?.remote?(0,_.jsxs)(`p`,{className:`text-muted-foreground text-1sm truncate`,"data-testid":`settings-sync-remote`,children:[(0,_.jsx)(r,{id:`Q8A-U_`}),` `,y.remote.webUrl?(0,_.jsxs)(`a`,{href:y.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5`,"aria-label":h({id:`1nke1r`,values:{0:y.remote.label}}),"data-testid":`settings-sync-remote-link`,children:[(0,_.jsx)(`span`,{children:y.remote.label}),(0,_.jsx)(Ee,{className:`inline size-3.5`,"aria-hidden":!0})]}):(0,_.jsx)(`span`,{className:`font-medium text-foreground`,"data-testid":`settings-sync-remote-label`,children:y.remote.label})]}):null,t[41]=h,t[42]=y,t[43]=P):P=t[43];let F;t[44]!==N||t[45]!==P?(F=(0,_.jsxs)(`div`,{className:`min-w-0`,children:[bt,N,P]}),t[44]=N,t[45]=P,t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,_.jsx)(p,{value:`off`,className:v,"data-testid":`settings-sync-mode-off`,children:(0,_.jsx)(r,{id:`BWTzAb`})}),t[47]=I):I=t[47];let L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,_.jsx)(p,{value:`follow`,className:v,"data-testid":`settings-sync-mode-follow`,children:(0,_.jsx)(r,{id:`tlGXxX`})}),t[48]=L):L=t[48];let R;t[49]!==it||t[50]!==k?(R=it?(0,_.jsxs)(c,{children:[(0,_.jsx)(o,{asChild:!0,children:(0,_.jsx)(`span`,{className:`inline-flex`,children:(0,_.jsx)(p,{value:`full`,className:v,disabled:!0,"aria-describedby":k?`settings-sync-denied-hint-text`:void 0,"data-testid":`settings-sync-mode-full`,children:(0,_.jsx)(r,{id:`IXiG0B`})})})}),(0,_.jsx)(s,{"data-testid":`settings-sync-mode-full-tip`,children:(0,_.jsx)(r,{id:`EiVgl5`})})]}):(0,_.jsx)(p,{value:`full`,className:v,"data-testid":`settings-sync-mode-full`,children:(0,_.jsx)(r,{id:`IXiG0B`})}),t[49]=it,t[50]=k,t[51]=R):R=t[51];let z;t[52]!==x||t[53]!==et||t[54]!==lt||t[55]!==R?(z=(0,_.jsxs)(ie,{type:`single`,variant:`outline`,spacing:2,value:x,onValueChange:lt,disabled:et,"aria-labelledby":`settings-sync-mode-label`,"data-testid":`settings-sync-mode-toggle`,children:[I,L,R]}),t[52]=x,t[53]=et,t[54]=lt,t[55]=R,t[56]=z):z=t[56];let B;t[57]!==F||t[58]!==z?(B=(0,_.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[F,z]}),t[57]=F,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==C||t[61]!==D?(V=D&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-reconnect`,children:[(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,_.jsx)(r,{id:`tnG-m6`})}),(0,_.jsx)(m,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>C(!0),children:(0,_.jsx)(r,{id:`5lWFkC`})})]}),t[60]=C,t[61]=D,t[62]=V):V=t[62];let H;t[63]!==S||t[64]!==O?(H=O&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-switch-follow`,children:[(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,_.jsx)(r,{id:`srdlOs`})}),(0,_.jsx)(m,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>S(`follow`),"data-testid":`settings-sync-switch-follow-action`,children:(0,_.jsx)(r,{id:`v16Pzh`})})]}),t[63]=S,t[64]=O,t[65]=H):H=t[65];let U;t[66]!==x||t[67]!==k?(U=k&&(0,_.jsx)(`p`,{id:`settings-sync-denied-hint-text`,className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-denied-hint`,children:x===`follow`?(0,_.jsx)(r,{id:`EiVgl5`}):(0,_.jsx)(r,{id:`eNOyTV`})}),t[66]=x,t[67]=k,t[68]=U):U=t[68];let W;t[69]===j?W=t[70]:(W=j!==null&&(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-reason`,children:j}),t[69]=j,t[70]=W);let G;t[71]!==j||t[72]!==y?.refusedSymlinkPaths?(G=j!==null&&(y?.refusedSymlinkPaths?.length??0)>0&&(0,_.jsx)(`div`,{className:`mt-2`,children:(0,_.jsx)(be,{paths:y?.refusedSymlinkPaths})}),t[71]=j,t[72]=y?.refusedSymlinkPaths,t[73]=G):G=t[73];let K;t[74]!==A||t[75]!==k||t[76]!==O||t[77]!==y?(K=y?.pushPermission?.checkStatus===`denied`&&(A||O||k)?(0,_.jsx)(`div`,{className:`mt-2 space-y-1`,"data-testid":`settings-sync-identity`,children:me(y.pushPermission).map(Fe)}):null,t[74]=A,t[75]=k,t[76]=O,t[77]=y,t[78]=K):K=t[78];let q;t[79]!==C||t[80]!==y?.pushPermission?(q=ye(y?.pushPermission)&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-signin-again`,children:[(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,_.jsx)(r,{id:`C_cPoW`})}),(0,_.jsx)(m,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>C(!0),children:(0,_.jsx)(r,{id:`5lWFkC`})})]}),t[79]=C,t[80]=y?.pushPermission,t[81]=q):q=t[81];let J;t[82]!==B||t[83]!==V||t[84]!==H||t[85]!==U||t[86]!==W||t[87]!==G||t[88]!==K||t[89]!==q?(J=(0,_.jsxs)(`div`,{className:`rounded-md border p-3`,children:[B,V,H,U,W,G,K,q]}),t[82]=B,t[83]=V,t[84]=H,t[85]=U,t[86]=W,t[87]=G,t[88]=K,t[89]=q,t[90]=J):J=t[90];let xt=x!==`off`&&(0,_.jsxs)(ne,{open:Ue,onOpenChange:We,children:[(0,_.jsx)(te,{asChild:!0,children:(0,_.jsxs)(m,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,"data-testid":`settings-sync-advanced-trigger`,children:[(0,_.jsx)(De,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`sxkWRg`})]})}),(0,_.jsx)(ee,{className:`pt-2`,children:(0,_.jsxs)(`div`,{className:`rounded-md border p-3 space-y-3`,"data-testid":`settings-sync-intervals`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{id:`settings-sync-pull-interval-label`,className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`Xs1kjx`})}),(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,_.jsx)(r,{id:`T1fMJ6`})})]}),(0,_.jsxs)(re,{value:String(b.pullIntervalSeconds),onValueChange:e=>vt(`pull`,e),disabled:!Re,children:[(0,_.jsx)(d,{size:`sm`,className:`w-40 shrink-0`,"aria-labelledby":`settings-sync-pull-interval-label`,"data-testid":`settings-sync-pull-interval`,children:(0,_.jsx)(f,{})}),(0,_.jsx)(u,{children:_t(b.pullIntervalSeconds).map(e=>(0,_.jsx)(l,{value:String(e),children:ht(e)},e))})]})]}),x===`full`&&(0,_.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-t pt-3`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{id:`settings-sync-push-interval-label`,className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`gyYvCN`})}),(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,_.jsx)(r,{id:`czQDKY`})})]}),(0,_.jsxs)(re,{value:String(b.pushIntervalSeconds),onValueChange:e=>vt(`push`,e),disabled:!Re,children:[(0,_.jsx)(d,{size:`sm`,className:`w-40 shrink-0`,"aria-labelledby":`settings-sync-push-interval-label`,"data-testid":`settings-sync-push-interval`,children:(0,_.jsx)(f,{})}),(0,_.jsx)(u,{children:_t(b.pushIntervalSeconds).map(e=>(0,_.jsx)(l,{value:String(e),children:ht(e)},e))})]})]}),x===`full`&&qe&&(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-sync-push-outpaces-pull-hint`,children:(0,_.jsx)(r,{id:`x-E_vF`})})]})})]}),St;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(St=(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`div`,{id:`settings-sync-default-label`,className:`text-sm font-medium`,children:(0,_.jsx)(r,{id:`j_Z6g7`})}),(0,_.jsx)(je,{scope:`project`})]}),t[91]=St):St=t[91];let Ct;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,_.jsxs)(`div`,{className:`space-y-0.5`,children:[St,(0,_.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,_.jsx)(r,{id:`msuDyW`})})]}),t[92]=Ct):Ct=t[92];let wt=!ze,Tt;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=(0,_.jsx)(p,{value:`ask`,className:v,"data-testid":`settings-sync-default-ask`,children:(0,_.jsx)(r,{id:`EdQY6l`})}),t[93]=Tt):Tt=t[93];let Et;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,_.jsx)(p,{value:`off`,className:v,"data-testid":`settings-sync-default-off`,children:(0,_.jsx)(r,{id:`BWTzAb`})}),t[94]=Et):Et=t[94];let Y;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,_.jsx)(p,{value:`follow`,className:v,"data-testid":`settings-sync-default-follow`,children:(0,_.jsx)(r,{id:`tlGXxX`})}),t[95]=Y):Y=t[95];let Dt;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,_.jsx)(p,{value:`full`,className:v,"data-testid":`settings-sync-default-full`,children:(0,_.jsx)(r,{id:`IXiG0B`})}),t[96]=Dt):Dt=t[96];let X;t[97]!==dt||t[98]!==pt||t[99]!==wt?(X=(0,_.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,"data-testid":`settings-sync-default`,children:[Ct,(0,_.jsxs)(ie,{type:`single`,variant:`outline`,spacing:2,value:dt,onValueChange:pt,disabled:wt,"aria-labelledby":`settings-sync-default-label`,"data-testid":`settings-sync-default-toggle`,children:[Tt,Et,Y,Dt]})]}),t[97]=dt,t[98]=pt,t[99]=wt,t[100]=X):X=t[100];let Ot=Ze??`full`,kt=Ze===`follow`?y?.ahead??0:0,Z;t[101]!==Ye||t[102]!==Qe||t[103]!==Xe||t[104]!==Ot||t[105]!==kt?(Z=(0,_.jsx)(_e,{open:Ye,onOpenChange:Xe,onConfirm:Qe,variant:Ot,strandedCommitCount:kt}),t[101]=Ye,t[102]=Qe,t[103]=Xe,t[104]=Ot,t[105]=kt,t[106]=Z):Z=t[106];let Q;t[107]===C?Q=t[108]:(Q=()=>C(!1),t[107]=C,t[108]=Q);let $;t[109]!==$e||t[110]!==C||t[111]!==Q?($=(0,_.jsx)(Ae,{open:$e,onOpenChange:C,onSuccess:Q,reauth:!0}),t[109]=$e,t[110]=C,t[111]=Q,t[112]=$):$=t[112];let At;return t[113]!==M||t[114]!==J||t[115]!==xt||t[116]!==X||t[117]!==Z||t[118]!==$?(At=(0,_.jsxs)(`div`,{className:`space-y-3`,children:[M,J,xt,X,Z,$]}),t[113]=M,t[114]=J,t[115]=xt,t[116]=X,t[117]=Z,t[118]=$,t[119]=At):At=t[119],At}function Fe(e){return(0,_.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:e},e)}function Ie(e,t){return e-t}export{y as SyncSection};
@@ -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{i as o,n as s,t as c}from"./tooltip-DBqLYfio.js";import{n as l,r as u,t as d}from"./collapsible-BKbszYZV.js";import{i as f,n as p,o as m,s as h,t as g}from"./select-Bu4Wm3Rf.js";import{t as _}from"./button-DzgjsZzC.js";import{n as v}from"./dist-BGzUo_18.js";import{t as y}from"./dist-C_FzPxEX2.js";import{n as b}from"./config-errors-DCSQBhyj.js";import{v as x}from"./documents-events-C04vpPEp.js";import{f as S,h as C}from"./share-D-LUU2aX-DfD-mrg-.js";import{i as w}from"./use-apply-config-theme-CYFG76sS.js";import{t as T}from"./createLucideIcon-DdBzwsHe.js";import{n as E,t as D}from"./arrow-up-BGHhPj4y.js";import{t as ee}from"./arrow-up-right-nJaICi16.js";import{t as O}from"./chevron-right-Bofu4lib.js";import{n as k,t as te}from"./settings-2-DoBlNQMk.js";import{t as A}from"./git-merge-VDBzSZBV.js";import{t as j}from"./spinner-Bx8xD6f8.js";import{t as M}from"./refresh-cw-CC7UZEnZ.js";import{t as N}from"./terminal-Cpb4l1oH.js";import{t as P}from"./triangle-alert-BXrUEeRU.js";import{t as F}from"./badge-DmdA1C7r.js";import{a as I,c as ne,i as L,n as re,o as ie,r as ae,s as oe,t as se}from"./dialog-BJEjKJjL.js";import{a as R,l as ce}from"./use-settings-route-DT86DJkF.js";import{c as le,h as ue,l as de}from"./doc-hash-BJkweiX9.js";import"./config-provider-Cs3B2_OX.js";import{a as z,i as fe,r as pe,t as me}from"./popover-BhiLJhH5.js";import{n as he}from"./use-git-sync-status-BQYF2F5Z.js";import{n as ge}from"./use-conflicts-CpABgIGI.js";import{n as B,t as _e}from"./DisclosureWarning-DGH1_U0o.js";import{t as ve}from"./terminal-command-events-DylLB9_L.js";var V=T(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),ye=T(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),be=T(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),xe=T(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),H=T(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Se=T(`git-commit-vertical`,[[`path`,{d:`M12 3v6`,key:`1holv5`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M12 15v6`,key:`a9ows0`}]]),Ce=T(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),we=T(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Te=T(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),U=a(),W=e(n(),1);function Ee(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=e?`full`:`off`,r=t.patch({autoSync:{mode:n,enabled:e}});return r.ok?{ok:!0}:{ok:!1,error:b(r.error)}},e[0]=t,e[1]=r),r}function De(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:{mode:e,enabled:null}});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Oe(){let e=(0,U.c)(2),{projectBinding:t,projectSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:{default:e}});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function ke(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Ae(e,t){let n=(0,U.c)(12),{_:r}=i(),[a,o]=(0,W.useState)(!1),s;n[0]!==r||n[1]!==e?(s=function(t){if(e===null)return v.info(r({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let n=e(t);if(!n.ok){console.error(`[sync] toggle failed:`,n.error);let e=n.error;return v.error(r(t?{id:`04RA0-`,values:{detail:e}}:{id:`qjHMHf`,values:{detail:e}})),!1}return!0},n[0]=r,n[1]=e,n[2]=s):s=n[2];let c=s,l;n[3]===c?l=n[4]:(l=function(e){if(e){o(!0);return}c(!1)},n[3]=c,n[4]=l);let u=l,d;n[5]!==c||n[6]!==t?(d=function(){c(!0)&&(o(!1),t?.onEnabled?.())},n[5]=c,n[6]=t,n[7]=d):d=n[7];let f=d,p;return n[8]!==a||n[9]!==f||n[10]!==u?(p={confirmOpen:a,setConfirmOpen:o,onToggleRequest:u,onConfirm:f},n[8]=a,n[9]=f,n[10]=u,n[11]=p):p=n[11],p}function je(e,t,n){let r=(0,U.c)(15),{_:a}=i(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),u;r[0]!==a||r[1]!==n||r[2]!==e?(u=function(t){if(e===null)return v.info(a({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let r=e(t);if(!r.ok){console.error(`[sync] mode change failed:`,r.error);let e=r.error;return v.error(a({id:`nOEDQs`,values:{detail:e}})),!1}return n?.onApplied?.(t),!0},r[0]=a,r[1]=n,r[2]=e,r[3]=u):u=r[3];let d=u,f;r[4]!==d||r[5]!==t?(f=function(e){if(e!==t){if(e===`off`){d(`off`);return}l(e),s(!0)}},r[4]=d,r[5]=t,r[6]=f):f=r[6];let p=f,m;r[7]!==d||r[8]!==c?(m=function(){c!==null&&d(c)&&s(!1)},r[7]=d,r[8]=c,r[9]=m):m=r[9];let h=m,g;return r[10]!==o||r[11]!==h||r[12]!==p||r[13]!==c?(g={confirmOpen:o,setConfirmOpen:s,pendingMode:c,onModeSelect:p,onConfirm:h},r[10]=o,r[11]=h,r[12]=p,r[13]=c,r[14]=g):g=r[14],g}function Me(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Ne(e,t){let n=(0,U.c)(18),{_:r}=i(),a=Me(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),u;n[0]===e?u=n[1]:(u=C(e)??`off`,n[0]=e,n[1]=u);let d=u,f;n[2]!==r||n[3]!==a?(f=function(e){if(a===null)return v.info(r({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let t=a(e);if(!t.ok){console.error(`[sync] badge control failed:`,t.error);let e=t.error;return v.error(r({id:`ZVOhXM`,values:{detail:e}})),!1}return!0},n[2]=r,n[3]=a,n[4]=f):f=n[4];let p=f,m;n[5]!==p||n[6]!==d?(m=function(e){if(e!==d){if(e===`off`){p({mode:`off`,enabled:null,resumeMode:null});return}l(e),s(!0)}},n[5]=p,n[6]=d,n[7]=m):m=n[7];let h=m,g;n[8]!==p||n[9]!==c?(g=function(){c!==null&&p({mode:c,enabled:null,resumeMode:null})&&(s(!1),l(null))},n[8]=p,n[9]=c,n[10]=g):g=n[10];let _=g,y=c===`follow`?t:0,b;return n[11]!==o||n[12]!==d||n[13]!==_||n[14]!==h||n[15]!==c||n[16]!==y?(b={mode:d,confirmOpen:o,setConfirmOpen:s,pendingMode:c,strandedCommitCount:y,onModeSelect:h,onConfirm:_},n[11]=o,n[12]=d,n[13]=_,n[14]=h,n[15]=c,n[16]=y,n[17]=b):b=n[17],b}async function Pe(e){let t=await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})});if(!t.ok)throw Error(`sync trigger failed: ${t.status}`)}var Fe=5e3,Ie=15e3,Le=3e4,Re=0;function ze(){let e=Date.now();e-Re<Le||(Re=e,Pe(`fetch`).catch(()=>{Re===e&&(Re=0)}))}async function Be(e){try{let t=await fetch(`/api/git/worktree-status`,{signal:e});if(!t.ok)return console.warn(`[sync] worktree status read failed: http`,t.status),{kind:`failed`,reason:`http`};let n=await t.json();return n.readable===!1?{kind:`unreadable`}:{kind:`ok`,status:n}}catch(t){return e.aborted?{kind:`failed`,reason:`aborted`}:(console.warn(`[sync] worktree status read failed: network`,t instanceof Error?t.message:t),{kind:`failed`,reason:`network`})}}var Ve={status:null,unreadable:!1,stale:!1,lastReadAt:null};function He(e){let t=(0,U.c)(9),[n,r]=(0,W.useState)(Ve),i,a;t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!1,n=!1,i=!1,a=null;function o(){if(n){i=!0;return}n=!0;let e=new AbortController;a=e;let s=setTimeout(()=>e.abort(),Ie);Be(e.signal).then(e=>{if(!t){if(e.kind===`ok`){r({status:e.status,unreadable:!1,stale:!1,lastReadAt:Date.now()});return}if(e.kind===`unreadable`){r(We);return}r(Ue)}}).finally(()=>{clearTimeout(s),a===e&&(a=null),n=!1,i&&!t&&(i=!1,o())})}o(),ze();let s=setInterval(o,Fe),c=x(e=>{e.includes(`sync-status`)&&o()});return()=>{t=!0,clearInterval(s),c(),a?.abort()}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,W.useEffect)(i,a);let o=e&&n.status===null&&!n.unreadable,s;return t[3]!==n.lastReadAt||t[4]!==n.stale||t[5]!==n.status||t[6]!==n.unreadable||t[7]!==o?(s={status:n.status,loading:o,unreadable:n.unreadable,stale:n.stale,lastReadAt:n.lastReadAt},t[3]=n.lastReadAt,t[4]=n.stale,t[5]=n.status,t[6]=n.unreadable,t[7]=o,t[8]=s):s=t[8],s}function Ue(e){return e.status===null?e.unreadable?e:{...e,unreadable:!0,stale:!1}:e.unreadable||e.stale?e:{...e,stale:!0}}function We(e){return{...e,unreadable:!0,stale:!1}}var G=t();function K(e){let t=(0,U.c)(4),{variant:n}=e;if((n===void 0?`full`:n)===`follow`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(ne,{children:(0,G.jsx)(r,{id:`W7mERj`})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(G.Fragment,{children:[e,(0,G.jsx)(I,{children:(0,G.jsx)(r,{id:`KmVekT`})})]}),t[1]=n):n=t[1],n}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(ne,{children:(0,G.jsx)(r,{id:`Uo2Rj7`})}),t[2]=i):i=t[2];let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsxs)(G.Fragment,{children:[i,(0,G.jsx)(I,{children:(0,G.jsx)(r,{id:`n6hXUm`})})]}),t[3]=a):a=t[3],a}function q(e){let t=(0,U.c)(2),{variant:n}=e,r=n===void 0?`full`:n,i;return t[0]===r?i=t[1]:(i=(0,G.jsx)(_e,{children:r===`follow`?(0,G.jsx)(Ke,{}):(0,G.jsx)(Ge,{})}),t[0]=r,t[1]=i),i}function Ge(){let e=(0,U.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(B,{icon:(0,G.jsx)(ye,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`cdmk8A`}),body:(0,G.jsx)(r,{id:`YaeyFh`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(B,{icon:(0,G.jsx)(Se,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`9i21pa`}),body:(0,G.jsx)(r,{id:`KIIamL`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsxs)(G.Fragment,{children:[t,n,(0,G.jsx)(B,{icon:(0,G.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`8cpeU3`}),body:(0,G.jsx)(r,{id:`DELNQk`})})]}),e[2]=i):i=e[2],i}function Ke(){let e=(0,U.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(B,{icon:(0,G.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`0xnQ_X`}),body:(0,G.jsx)(r,{id:`aCoQfY`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(B,{icon:(0,G.jsx)(Ce,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`5rnB76`}),body:(0,G.jsx)(r,{id:`kXNv8P`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsxs)(G.Fragment,{children:[t,n,(0,G.jsx)(B,{icon:(0,G.jsx)(A,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`oBK5fD`}),body:(0,G.jsx)(r,{id:`8Wav8y`})})]}),e[2]=i):i=e[2],i}function qe(e){let t=(0,U.c)(24),{open:n,onOpenChange:i,onConfirm:a,variant:o,strandedCommitCount:s}=e,c=o===void 0?`full`:o,l=s===void 0?0:s,u=c===`follow`&&l>0,d;t[0]===c?d=t[1]:(d=(0,G.jsx)(oe,{children:(0,G.jsx)(K,{variant:c})}),t[0]=c,t[1]=d);let f;t[2]===c?f=t[3]:(f=(0,G.jsx)(q,{variant:c}),t[2]=c,t[3]=f);let p;t[4]!==u||t[5]!==l?(p=u&&(0,G.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:(0,G.jsx)(r,{id:`caw8gO`,values:{strandedCommitCount:l}})}),t[4]=u,t[5]=l,t[6]=p):p=t[6];let m;t[7]!==f||t[8]!==p?(m=(0,G.jsxs)(re,{children:[f,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(ae,{asChild:!0,children:(0,G.jsx)(_,{variant:`outline`,children:(0,G.jsx)(r,{id:`dEgA5A`})})}),t[10]=h):h=t[10];let g;t[11]===c?g=t[12]:(g=c===`follow`?(0,G.jsx)(r,{id:`jTUxaN`}):(0,G.jsx)(r,{id:`pPiV8s`}),t[11]=c,t[12]=g);let v;t[13]!==a||t[14]!==g?(v=(0,G.jsxs)(ie,{children:[h,(0,G.jsx)(_,{onClick:a,children:g})]}),t[13]=a,t[14]=g,t[15]=v):v=t[15];let y;t[16]!==d||t[17]!==m||t[18]!==v?(y=(0,G.jsxs)(L,{className:`sm:max-w-lg`,children:[d,m,v]}),t[16]=d,t[17]=m,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==i||t[21]!==n||t[22]!==y?(b=(0,G.jsx)(se,{open:n,onOpenChange:i,children:y}),t[20]=i,t[21]=n,t[22]=y,t[23]=b):b=t[23],b}async function Je(e){let t=await fetch(`/api/sync/resolve-blocking`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:e})});if(!t.ok)throw Error(`sync resolve-blocking failed: ${t.status}`)}function Ye(){return typeof window<`u`&&window.okDesktop!=null}function Xe(e){let t=(0,U.c)(23),{paths:n}=e,[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(!1);if(n.length===0)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=async function(e){a(e),s(!1);try{await Je(e),a(null)}catch{s(!0),a(null)}},t[0]=c):c=t[0];let l=c,u=i!==null,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(`span`,{id:`sync-blocking-heading`,className:`text-xs font-medium text-foreground`,children:(0,G.jsx)(r,{id:`sdvHp3`})}),t[1]=d):d=t[1];let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[d,(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`H4doZt`})})]}),t[2]=f):f=t[2];let p;t[3]===n?p=t[4]:(p=n.map(Qe),t[3]=n,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,G.jsx)(`ul`,{"aria-labelledby":`sync-blocking-heading`,className:`flex max-h-28 flex-col gap-1 overflow-y-auto overscroll-contain`,"data-testid":`sync-blocking-list`,children:p}),t[5]=p,t[6]=m);let h;t[7]===o?h=t[8]:(h=o&&(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`sync-blocking-error`,children:(0,G.jsx)(r,{id:`FsEXax`})}),t[7]=o,t[8]=h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>void l(`commit`),t[9]=g):g=t[9];let v;t[10]===i?v=t[11]:(v=i===`commit`&&(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}),t[10]=i,t[11]=v);let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsx)(r,{id:`N7Lau6`}),t[12]=y):y=t[12];let b;t[13]!==u||t[14]!==v?(b=(0,G.jsxs)(_,{size:`xs`,disabled:u,onClick:g,"data-testid":`sync-blocking-commit`,children:[v,y]}),t[13]=u,t[14]=v,t[15]=b):b=t[15];let x;t[16]===u?x=t[17]:(x=Ye()&&(0,G.jsxs)(_,{variant:`link-muted`,size:`xs`,className:`self-start p-0`,disabled:u,onClick:Ze,"data-testid":`sync-blocking-terminal`,children:[(0,G.jsx)(N,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`6EoD0z`})]}),t[16]=u,t[17]=x);let S;return t[18]!==b||t[19]!==x||t[20]!==m||t[21]!==h?(S=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t pt-3`,children:[f,m,h,b,x]}),t[18]=b,t[19]=x,t[20]=m,t[21]=h,t[22]=S):S=t[22],S}function Ze(){return ve(`git-status`)}function Qe(e){return(0,G.jsx)(`li`,{title:e,className:`min-w-0 truncate font-mono text-2xs text-foreground`,children:e},e)}function J(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function $e(e){return e===``?[]:e.split(`/`)}function et(e){if(e.length===0)return``;let t=$e(J(e[0]));for(let n of e.slice(1)){let e=$e(J(n)),r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];)r++;if(t=t.slice(0,r),t.length===0)break}return t.join(`/`)}function Y(e,t){return e===``?t:t.slice(e.length+1)}function tt(e,t=8){if(e.length===0)return{prefix:``,groups:[],loose:[]};if(e.length===1)return{prefix:``,groups:[],loose:[{entry:e[0],label:e[0].path}]};let n=et(e.map(e=>e.path)),r=e.map(e=>{let t=Y(n,e.path);return{entry:e,rel:t,key:J(t)}}),i=()=>new Set(r.map(e=>e.key));for(;i().size>t;){let e=Math.max(...r.map(e=>$e(e.key).length));if(e===0)break;for(let t of r)$e(t.key).length===e&&(t.key=J(t.key))}let a=new Map;for(let{entry:e,rel:t,key:n}of r){let r=a.get(n)??[];r.push({entry:e,label:n===``?t:t.slice(n.length+1)}),a.set(n,r)}let o=[],s=[];for(let[e,t]of a)if(e===``||t.length===1)for(let e of t)s.push({entry:e.entry,label:Y(n,e.entry.path)});else o.push({dir:e,rows:t});return o.sort((e,t)=>t.rows.length-e.rows.length||e.dir.localeCompare(t.dir)),s.sort((e,t)=>e.entry.path.localeCompare(t.entry.path)),{prefix:n,groups:o,loose:s}}function nt(e=`sync`,t){Pe(e).catch(e=>{console.warn(`[sync-badge] manual sync trigger failed`,e instanceof Error?e.message:e),t?.()})}function rt(e){typeof window>`u`||ue(window.location.hash,e)||(window.location.hash=e)}function it(e){return e.kind===`doc`?de(e.docName):le(e.path)}var at=3e4;function X(e,t,n){let r=n-t;return r<6e4?e({id:`xOTzt5`}):r<36e5?e({id:`_rP3HI`,values:{minutes:Math.floor(r/6e4)}}):r<864e5?e({id:`nYeBmY`,values:{hours:Math.floor(r/36e5)}}):new Date(t).toLocaleDateString()}function Z(e,t){return X(e,new Date(t).getTime(),Date.now())}function ot(){let e=(0,U.c)(2),[t,n]=(0,W.useState)(st),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=setInterval(()=>n(Date.now()),at);return()=>clearInterval(e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,W.useEffect)(r,i),t}function st(){return Date.now()}function Q(e){return e.syncMode===`follow`}var ct=[`git-operation-in-progress`,`unsafe-incoming-symlinks`];function $(e){return ct.includes(e)}function lt(e){return e.state===`idle`&&e.conflictCount>0?`conflict`:(e.state===`idle`||e.state===`offline`)&&$(e.pausedReason)?`disabled`:e.state}function ut(e){let t=(0,U.c)(12),{status:n}=e;switch(lt(n)){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(H,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(M,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(H,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(j,{"aria-hidden":`true`,icon:M,className:`size-3.5 text-muted-foreground`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(P,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(xe,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===n?e=t[7]:(e=Et(n)?(0,G.jsx)(be,{className:`size-3.5 text-destructive`}):(0,G.jsx)(we,{className:`size-3.5 text-destructive`}),t[6]=n,t[7]=e),e}case`disabled`:{if(n.pausedReason){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(P,{className:`size-3.5 text-amber-500`}),t[8]=e):e=t[8],e}if(n.ahead>0||n.behind>0){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(M,{className:`size-3.5 text-muted-foreground`}),t[9]=e):e=t[9],e}let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(H,{className:`size-3.5 text-muted-foreground`}),t[10]=e):e=t[10],e}default:{let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(H,{className:`size-3.5 text-muted-foreground`}),t[11]=e):e=t[11],e}}}function dt(e){switch(lt(e)){case`idle`:return!Q(e)&&e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function ft(e){let t=Q(e),n=lt(e);switch(n){case`dormant`:return y._({id:`RmBY0A`});case`idle`:return t?y._({id:`j5CWO4`}):y._({id:`N2FcBE`});case`fetching`:return t?y._({id:`7IsvrP`}):y._({id:`Wgmlsw`});case`pulling`:return t?y._({id:`JL3si7`}):y._({id:`4uNLmk`});case`pushing`:return y._({id:`iycx_A`});case`conflict`:return y._({id:`IInnZo`});case`offline`:return y._({id:`6Aih4U`});case`auth-error`:return y._({id:`mHVPm5`});case`disabled`:return e.pausedReason?y._({id:`U6wmNc`}):y._({id:`BWTzAb`});default:return n}}var pt=[`git-index-locked`],mt={"git-index-locked":{id:`sOcMdy`},"git-operation-in-progress":{id:`mJTr6D`},"external-changes-pending":{id:`W9_Bub`},"dirty-tree":{id:`a5Gha5`},"non-content-merge-failure":{id:`sIxSSP`},"detached-head":{id:`uQNW00`},"diverged-local-commits":{id:`LQsCPn`},"auth-error":{id:`mHVPm5`},"protected-branch":{id:`8fc_3j`},"no-push-permission":{id:`EiVgl5`},"no-commits-yet":{id:`-ZVU5v`},"unsafe-incoming-symlinks":{id:`8qsUJv`}};function ht(e){return Object.hasOwn(mt,e)}function gt(e,t){return ht(t)?e(mt[t]):t}function _t(e){return pt.includes(e)}function vt(e){throw Error(`Unhandled node-rendered paused reason: ${String(e)}`)}function yt(e){let t=(0,U.c)(3),{reason:n}=e;switch(n){case`git-index-locked`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(r,{id:`Qca--K`,components:{0:(0,G.jsx)(`span`,{dir:`ltr`,className:`font-mono`})}}),t[0]=e):e=t[0],e}default:{let e;return t[1]===n?e=t[2]:(e=vt(n),t[1]=n,t[2]=e),e}}}function bt(e){let t=(0,U.c)(4),{paths:n}=e;if(n===void 0||n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(xt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,G.jsx)(`ul`,{className:`flex max-h-28 flex-col gap-1 overflow-y-auto overscroll-contain`,"data-testid":`sync-refused-symlinks`,children:r}),t[2]=r,t[3]=i),i}function xt(e){return(0,G.jsx)(`li`,{title:e,dir:`ltr`,className:`min-w-0 truncate font-mono text-2xs text-foreground`,children:e},e)}function St(e){let t=(0,U.c)(7),{reason:n}=e,{_:r}=i();if(_t(n)){let e;return t[0]===n?e=t[1]:(e=(0,G.jsx)(yt,{reason:n}),t[0]=n,t[1]=e),e}let a;t[2]!==r||t[3]!==n?(a=gt(r,n),t[2]=r,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,G.jsx)(G.Fragment,{children:a}),t[5]=a,t[6]=o),o}function Ct(e,t){let n=[];switch(e){case`not-authenticated`:n.push(y._({id:`ycIX5i`}));break;case`no-collaborator`:n.push(y._({id:`EiVgl5`}));break;case`private-no-access`:n.push(y._({id:`07gHun`}));break;case`repo-not-found`:n.push(y._({id:`uksqrP`}));break;default:n.push(y._({id:`EiVgl5`}))}return n.push(...wt(t)),n}function wt(e){let t=[];if(e?.resolvedLogin){let n=e.resolvedLogin;t.push(y._({id:`ZKVuLY`,values:{login:n}}))}return e?.declaredLogin&&t.push(Tt(e.declaredLogin,e.declaredSource)),t}function Tt(e,t){switch(t){case`remote-url`:return y._({id:`CMd-g-`,values:{declaredLogin:e}});case`credential-config`:return y._({id:`akOe4q`,values:{declaredLogin:e}});default:return y._({id:`GBEqoP`,values:{declaredLogin:e}})}}function Et(e){return e.pushErrorCode===`auth-not-found-as-identity`||e.pullErrorCode===`auth-not-found-as-identity`}function Dt(e){return e?.pausedReason===`auth-error`&&Et(e)}function Ot(e){return e?.checkStatus===`denied`&&e.deniedReason===`not-authenticated`}function kt(e){return typeof e?.webUrl==`string`}function At(e){return e!=null&&!kt(e)}function jt(e){return e?.transport===void 0||e.transport===`https`}function Mt(e,t){switch(e){case`auth-401`:return t?y._({id:`-Qw-1t`}):y._({id:`LVWA9A`});case`auth-scope-mismatch`:return t?y._({id:`Zue_jx`}):y._({id:`yLyiQV`});case`auth-no-credential`:return t?y._({id:`uCaIdy`}):y._({id:`xJ7qrb`});default:return null}}function Nt(e,t){let n=Mt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`EiVgl5`});case`semantic-protected-branch`:return y._({id:`T0OVm7`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`1AumWo`})}}function Pt(e,t){let n=Mt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`RgbKEe`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`jZ_E5M`})}}function Ft(e,t){let n=Mt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`RgbKEe`});case`semantic-protected-branch`:return y._({id:`T0OVm7`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`cUk6TF`})}}function It(e){let t=kt(e.remote),n=e.pushErrorCode!=null||e.pushError!=null,r=e.pullErrorCode!=null||e.pullError!=null;if(n&&r&&(e.pushErrorCode==null?e.pullErrorCode==null&&e.pushError===e.pullError:e.pushErrorCode===e.pullErrorCode))return[{key:`sync`,direction:null,message:e.pushErrorCode==null?e.pushError:Ft(e.pushErrorCode,t)}];let i=n&&r,a=[];return n&&a.push({key:`push`,direction:i?`push`:null,message:e.pushErrorCode?Nt(e.pushErrorCode,t):e.pushError}),r&&a.push({key:`pull`,direction:i?`pull`:null,message:e.pullErrorCode?Pt(e.pullErrorCode,t):e.pullError}),a}function Lt(e){return e?.checkStatus===`unknown`&&e.unknownError===`token-invalid`}function Rt(e){return lt(e)===`auth-error`&&Et(e)?y._({id:`EkEFE3`}):ft(e)}function zt(e){let t=Q(e),n=lt(e);if(n===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return y._({id:`cUK8lW`,values:{conflictCount:t}})}if(n===`idle`){let{ahead:n,behind:r}=e;return t?r>0?y._({id:`9o1bIV`,values:{behind:r}}):y._({id:`j5CWO4`}):n>0&&r>0?y._({id:`5F5HYj`,values:{ahead:n,behind:r}}):n>0?y._({id:`PdA9NZ`,values:{ahead:n}}):r>0?y._({id:`9o1bIV`,values:{behind:r}}):y._({id:`N2FcBE`})}return Rt(e)}function Bt(e){let t=(0,U.c)(3),{children:n,id:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,G.jsx)(`span`,{id:r,className:`font-mono uppercase tracking-wide text-2xs text-muted-foreground`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Vt(e){switch(e){case`M`:return y._({id:`tgWuMB`});case`A`:return y._({id:`hp8OtS`});case`D`:return y._({id:`vGjmyl`});case`R`:return y._({id:`QeREu8`});case`C`:return y._({id:`6V3Ea3`});case`U`:return y._({id:`cyoNqf`});case`T`:return y._({id:`zWZBPx`});case`?`:return y._({id:`C2abof`});case`!`:return y._({id:`xDKOFk`});default:return y._({id:`cNsIJf`})}}function Ht(e){switch(e){case`D`:return`destructive`;case`U`:return`warning`;default:return`gray`}}function Ut(e){let t=(0,U.c)(25),{entry:n,dimmed:r,label:i}=e,a;t[0]===n.code?a=t[1]:(a=Vt(n.code),t[0]=n.code,t[1]=a);let l=a,u=n.open,d=`truncate text-start font-mono text-2xs ${r?`text-muted-foreground/60`:`text-foreground`}`,f;t[2]===n.code?f=t[3]:(f=Ht(n.code),t[2]=n.code,t[3]=f);let p;t[4]===n.code?p=t[5]:(p=(0,G.jsx)(`span`,{"aria-hidden":!0,children:n.code}),t[4]=n.code,t[5]=p);let m;t[6]===l?m=t[7]:(m=(0,G.jsx)(`span`,{className:`sr-only`,children:l}),t[6]=l,t[7]=m);let h;t[8]!==f||t[9]!==p||t[10]!==m?(h=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsxs)(F,{variant:f,className:`size-4 shrink-0 justify-center p-0 text-2xs leading-none`,children:[p,m]})}),t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===l?g=t[13]:(g=(0,G.jsx)(s,{children:l}),t[12]=l,t[13]=g);let v;t[14]!==h||t[15]!==g?(v=(0,G.jsxs)(c,{children:[h,g]}),t[14]=h,t[15]=g,t[16]=v):v=t[16];let y;t[17]!==n.path||t[18]!==i||t[19]!==u||t[20]!==d?(y=u?(0,G.jsxs)(c,{children:[(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(_,{variant:`link-muted`,size:`xs`,className:`h-auto min-h-6 min-w-0 shrink justify-start overflow-hidden p-0 font-normal`,"aria-label":n.path,onClick:()=>rt(it(u)),"data-testid":`worktree-row-open`,children:(0,G.jsx)(`span`,{dir:`auto`,className:`min-w-0 ${d}`,children:i})})})}),(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:n.path})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(c,{children:[(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(`span`,{dir:`auto`,tabIndex:0,className:`min-w-0 rounded-xs focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 ${d}`,children:i})}),(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:n.path})]}),i!==n.path&&(0,G.jsx)(`span`,{className:`sr-only`,children:n.path})]}),t[17]=n.path,t[18]=i,t[19]=u,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==v||t[23]!==y?(b=(0,G.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[22]=v,t[23]=y,t[24]=b):b=t[24],b}function Wt(e){let t=(0,U.c)(15),{rows:n,dimmed:i}=e,[a,o]=(0,W.useState)(!1),s=n.length>6,c;t[0]!==n||t[1]!==a?(c=a?n:n.slice(0,6),t[0]=n,t[1]=a,t[2]=c):c=t[2];let l=c,u=n.length-6,d;if(t[3]!==i||t[4]!==l){let e;t[6]===i?e=t[7]:(e=e=>{let{entry:t,label:n}=e;return(0,G.jsx)(Ut,{entry:t,dimmed:i,label:n},`${t.code}:${t.path}`)},t[6]=i,t[7]=e),d=l.map(e),t[3]=i,t[4]=l,t[5]=d}else d=t[5];let f;t[8]!==s||t[9]!==u||t[10]!==a?(f=s&&(0,G.jsx)(`li`,{children:(0,G.jsx)(_,{variant:`link-muted`,size:`xs`,"aria-expanded":a,className:`h-auto min-h-6 justify-start p-0 text-2xs font-normal`,onClick:()=>o(Gt),"data-testid":`worktree-rows-show-all`,children:a?(0,G.jsx)(r,{id:`H86f9p`}):(0,G.jsx)(r,{id:`B6Lac2`,values:{overflowCount:u}})})}),t[8]=s,t[9]=u,t[10]=a,t[11]=f):f=t[11];let p;return t[12]!==d||t[13]!==f?(p=(0,G.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14],p}function Gt(e){return!e}function Kt(e){let t=(0,U.c)(25),{group:n,prefix:i,dimmed:a}=e,f=n.rows.length,[p,m]=(0,W.useState)(!1),h=i===``?n.dir:`${i}/${n.dir}`,g=`size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none ${p?`rotate-90`:``}`,v;t[0]===g?v=t[1]:(v=(0,G.jsx)(O,{className:g,"aria-hidden":!0}),t[0]=g,t[1]=v);let y;t[2]===n.dir?y=t[3]:(y=(0,G.jsx)(`span`,{dir:`auto`,className:`min-w-0 truncate text-start font-mono text-2xs text-muted-foreground`,children:n.dir}),t[2]=n.dir,t[3]=y);let b;t[4]===f?b=t[5]:(b=(0,G.jsx)(`span`,{"aria-hidden":!0,className:`ms-auto shrink-0 ps-1 text-2xs text-muted-foreground tabular-nums`,children:f}),t[4]=f,t[5]=b);let x;t[6]===f?x=t[7]:(x=(0,G.jsx)(`span`,{className:`sr-only`,children:(0,G.jsx)(r,{id:`u3BOHd`,values:{fileCount:f}})}),t[6]=f,t[7]=x);let S;t[8]!==v||t[9]!==y||t[10]!==b||t[11]!==x?(S=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(u,{asChild:!0,children:(0,G.jsxs)(_,{variant:`ghost`,size:`xs`,className:`h-auto min-h-6 w-full justify-start gap-1 px-0 font-normal`,children:[v,y,b,x]})})}),t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S):S=t[12];let C;t[13]===h?C=t[14]:(C=(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:h}),t[13]=h,t[14]=C);let w;t[15]!==S||t[16]!==C?(w=(0,G.jsxs)(c,{children:[S,C]}),t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==a||t[19]!==n.rows?(T=(0,G.jsx)(l,{className:`ps-4`,children:(0,G.jsx)(Wt,{rows:n.rows,dimmed:a})}),t[18]=a,t[19]=n.rows,t[20]=T):T=t[20];let E;return t[21]!==p||t[22]!==w||t[23]!==T?(E=(0,G.jsxs)(d,{open:p,onOpenChange:m,className:`flex flex-col gap-1`,children:[w,T]}),t[21]=p,t[22]=w,t[23]=T,t[24]=E):E=t[24],E}function qt(e){let t=(0,U.c)(39),{title:n,note:i,entries:a,dimmed:o}=e,s=o===void 0?!1:o;if(a.length===0)return null;let c=a.length,f,p,m,h,g,v,y,b,x;if(t[0]!==s||t[1]!==a||t[2]!==c||t[3]!==i||t[4]!==n){let{prefix:e,groups:o,loose:S}=tt(a);m=S,p=d,b=`flex flex-col gap-1`;let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,G.jsx)(O,{className:`size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-90`,"aria-hidden":!0}),t[14]=C):C=t[14];let w;t[15]===n?w=t[16]:(w=(0,G.jsx)(`span`,{className:`text-2xs font-medium text-muted-foreground`,children:n}),t[15]=n,t[16]=w);let T;t[17]===c?T=t[18]:(T=(0,G.jsx)(`span`,{className:`ms-auto shrink-0 ps-1 text-2xs text-muted-foreground tabular-nums`,children:(0,G.jsx)(r,{id:`u3BOHd`,values:{fileCount:c}})}),t[17]=c,t[18]=T),t[19]!==w||t[20]!==T?(x=(0,G.jsx)(u,{asChild:!0,children:(0,G.jsxs)(_,{variant:`ghost`,size:`xs`,className:`group h-auto min-h-6 w-full justify-start gap-1 px-0 font-normal data-[state=open]:bg-transparent`,children:[C,w,T]})}),t[19]=w,t[20]=T,t[21]=x):x=t[21],f=l,h=`flex flex-col gap-1 ps-3`,t[22]===i?g=t[23]:(g=i&&(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground/80`,children:i}),t[22]=i,t[23]=g),v=e!==``&&(0,G.jsxs)(`span`,{dir:`auto`,className:`break-all font-mono text-2xs text-muted-foreground`,children:[e,`/`]}),y=o.map(t=>(0,G.jsx)(Kt,{group:t,prefix:e,dimmed:s},e===``?t.dir:`${e}/${t.dir}`)),t[0]=s,t[1]=a,t[2]=c,t[3]=i,t[4]=n,t[5]=f,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=v,t[11]=y,t[12]=b,t[13]=x}else f=t[5],p=t[6],m=t[7],h=t[8],g=t[9],v=t[10],y=t[11],b=t[12],x=t[13];let S;t[24]!==s||t[25]!==m?(S=m.length>0&&(0,G.jsx)(Wt,{rows:m,dimmed:s}),t[24]=s,t[25]=m,t[26]=S):S=t[26];let C;t[27]!==f||t[28]!==h||t[29]!==g||t[30]!==v||t[31]!==y||t[32]!==S?(C=(0,G.jsxs)(f,{className:h,children:[g,v,y,S]}),t[27]=f,t[28]=h,t[29]=g,t[30]=v,t[31]=y,t[32]=S,t[33]=C):C=t[33];let w;return t[34]!==p||t[35]!==b||t[36]!==x||t[37]!==C?(w=(0,G.jsxs)(p,{className:b,children:[x,C]}),t[34]=p,t[35]=b,t[36]=x,t[37]=C,t[38]=w):w=t[38],w}function Jt(e){let t=(0,U.c)(9),{direction:n,count:r}=e,{_:a}=i();if(r<=0)return null;let o;t[0]===n?o=t[1]:(o=n===`behind`?(0,G.jsx)(E,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,G.jsx)(D,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]!==a||t[3]!==r||t[4]!==n?(s=a(n===`behind`?{id:`sKHiNR`,values:{count:r}}:{id:`9ZxzfT`,values:{count:r}}),t[2]=a,t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,G.jsxs)(`span`,{className:`flex flex-1 items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs text-foreground`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Yt(e){let t=new Set,n=[],r=[];for(let i of[...e.staged,...e.notStaged,...e.untracked])t.has(i.path)||(t.add(i.path),(i.syncScoped?n:r).push(i));return{willPush:n,wontPush:r}}function Xt(e){let t=(0,U.c)(6),{lastReadAt:n}=e,{_:a}=i(),o=ot(),s;t[0]!==a||t[1]!==n||t[2]!==o?(s=X(a,n,o),t[0]=a,t[1]=n,t[2]=o,t[3]=s):s=t[3];let c=s,l;return t[4]===c?l=t[5]:(l=(0,G.jsx)(`p`,{className:`text-2xs text-muted-foreground`,"data-testid":`worktree-stale`,children:(0,G.jsx)(r,{id:`e-pP6g`,values:{staleRelative:c}})}),t[4]=c,t[5]=l),l}function Zt(e){let t=(0,U.c)(36),{status:n,worktree:a,loading:o,unreadable:s,stale:c,lastReadAt:l}=e,u;t[0]===a?u=t[1]:(u=a?Yt(a):{willPush:[],wontPush:[]},t[0]=a,t[1]=u);let{willPush:d,wontPush:f}=u,p;t[2]===a?.incoming?p=t[3]:(p=a?.incoming??[],t[2]=a?.incoming,t[3]=p);let m=p,{_:h}=i(),g=c&&!s&&a!==null&&l!==null,_=a!==null&&d.length===0&&f.length===0&&m.length===0,v;t[4]!==h||t[5]!==g||t[6]!==s?(v=s?h({id:`L9ox9k`}):g?h({id:`_LK4d6`}):``,t[4]=h,t[5]=g,t[6]=s,t[7]=v):v=t[7];let y=v,b;t[8]===y?b=t[9]:(b=(0,G.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"data-testid":`worktree-announcer`,children:y}),t[8]=y,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,G.jsx)(Bt,{id:`worktree-status-label`,children:(0,G.jsx)(r,{id:`uAQUqI`})}),t[10]=x):x=t[10];let S;t[11]!==s||t[12]!==a?(S=!s&&a&&(a.branch||a.detached)&&(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-2xs text-muted-foreground`,"data-testid":`worktree-branch`,children:a.detached?(0,G.jsx)(r,{id:`OBdkpo`}):a.upstream?`${a.branch} → ${a.upstream}`:a.branch}),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[x,S]}),t[14]=S,t[15]=C);let w;t[16]!==n.ahead||t[17]!==n.behind?(w=(n.behind>0||n.ahead>0)&&(0,G.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,G.jsx)(Jt,{direction:`behind`,count:n.behind}),(0,G.jsx)(Jt,{direction:`ahead`,count:n.ahead})]}),t[16]=n.ahead,t[17]=n.behind,t[18]=w):w=t[18];let T;t[19]!==_||t[20]!==m||t[21]!==o||t[22]!==s||t[23]!==d||t[24]!==f||t[25]!==a?(T=s?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`worktree-unreadable`,children:(0,G.jsx)(r,{id:`L9ox9k`})}):o?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`eolhcI`})}):_?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`WfcERq`})}):a&&(0,G.jsxs)(`section`,{className:`flex max-h-56 flex-col gap-2.5 overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,tabIndex:0,"aria-labelledby":`worktree-status-label`,"data-testid":`worktree-listing`,children:[(0,G.jsx)(qt,{title:(0,G.jsx)(r,{id:`NcwbBM`}),entries:m}),(0,G.jsx)(qt,{title:(0,G.jsx)(r,{id:`JOhCT9`}),entries:d}),(0,G.jsx)(qt,{title:(0,G.jsx)(r,{id:`vsFXfP`}),note:(0,G.jsx)(r,{id:`PxZCNM`}),entries:f,dimmed:!0}),a.truncated&&(0,G.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`KvwJv8`})})]}),t[19]=_,t[20]=m,t[21]=o,t[22]=s,t[23]=d,t[24]=f,t[25]=a,t[26]=T):T=t[26];let E;t[27]!==l||t[28]!==g?(E=g&&l!==null&&(0,G.jsx)(Xt,{lastReadAt:l}),t[27]=l,t[28]=g,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==b||t[32]!==C||t[33]!==w||t[34]!==T?(D=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t pt-3`,children:[b,C,w,T,E]}),t[30]=E,t[31]=b,t[32]=C,t[33]=w,t[34]=T,t[35]=D):D=t[35],D}function Qt(e){let t=(0,U.c)(19),{pulledAt:n,pushedAt:r,combinedAt:a}=e,{_:o}=i(),s,c,l;if(t[0]!==o||t[1]!==a||t[2]!==n||t[3]!==r){s=n===null?null:Z(o,n),c=r===null?null:Z(o,r);let e=a===null?null:Z(o,a);l=s!==null&&c!==null?o({id:`1TA-aJ`,values:{pulled:s,pushed:c}}):s===null?c===null?e===null?null:o({id:`irnKr_`,values:{updatedRelative:e}}):o({id:`lPkjpD`,values:{pushed:c}}):o({id:`xW5AUw`,values:{pulled:s}}),t[0]=o,t[1]=a,t[2]=n,t[3]=r,t[4]=s,t[5]=c,t[6]=l}else s=t[4],c=t[5],l=t[6];let u=l,d=s!==null||c!==null;if(u===null){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(`span`,{}),t[7]=e):e=t[7],e}let f;t[8]!==u||t[9]!==d?(f=d&&(0,G.jsx)(`span`,{className:`sr-only`,"data-testid":`sync-popover-last-sync-label`,children:u}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==u||t[12]!==s||t[13]!==c||t[14]!==d?(p=d?(0,G.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex items-center gap-1`,children:[s!==null&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(E,{className:`size-3`}),s]}),s!==null&&c!==null&&(0,G.jsx)(`span`,{children:`·`}),c!==null&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(D,{className:`size-3`}),c]})]}):(0,G.jsx)(`span`,{"aria-hidden":`true`,children:u}),t[11]=u,t[12]=s,t[13]=c,t[14]=d,t[15]=p):p=t[15];let m;return t[16]!==f||t[17]!==p?(m=(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-last-sync`,children:[f,p]}),t[16]=f,t[17]=p,t[18]=m):m=t[18],m}function $t(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:en,"data-testid":`sync-popover-add-host-token`,children:(0,G.jsx)(r,{id:`zXZJoN`})})}),e[0]=t):t=e[0],t}function en(){return R()}function tn(e){let t=(0,U.c)(152),{status:n,onSignIn:a,onSetIdentity:o}=e,{_:s}=i(),{conflictCount:c}=n,{projectLocalConfig:l,projectLocalSynced:u}=w(),d=l?.autoSync,{mode:v,confirmOpen:y,setConfirmOpen:b,pendingMode:x,strandedCommitCount:C,onModeSelect:T,onConfirm:O}=Ne(d,n.ahead),{status:k,loading:A,unreadable:N,stale:P,lastReadAt:F}=He(!0),I=v===`follow`,ne;t[0]===n?ne=t[1]:(ne=lt(n),t[0]=n,t[1]=ne);let L=ne,re;t[2]===n?re=t[3]:(re=Et(n),t[2]=n,t[3]=re);let ie=re,ae=n.lastPullOkUtc??null,oe=n.lastPushOkUtc??null,se=n.lastRunUtc??n.lastSyncUtc??null,R=n.pushPermission?.checkStatus===`denied`&&n.pushPermission.deniedReason!==`not-authenticated`&&!ie,ce;t[4]===n.remote?ce=t[5]:(ce=kt(n.remote),t[4]=n.remote,t[5]=ce);let le=ce,ue=!R,z=L===`fetching`||L===`pulling`||L===`pushing`,[fe,me]=(0,W.useState)(null),he,B;t[6]===z?(he=t[7],B=t[8]):(he=()=>{z||me(null)},B=[z],t[6]=z,t[7]=he,t[8]=B),(0,W.useEffect)(he,B);let _e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{me(t=>t===e?null:t)},t[9]=_e):_e=t[9];let ve=_e,V=z?fe??(L===`pushing`?`push`:`pull`):null,ye;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ye=e=>{me(e),nt(e,()=>ve(e))},t[10]=ye):ye=t[10];let be=ye,xe=L===`dormant`||L===`auth-error`||n.state===`conflict`,H=xe||n.conflictCount>0,Se;t[11]===n.blockingPaths?Se=t[12]:(Se=n.blockingPaths??[],t[11]=n.blockingPaths,t[12]=Se);let Ce=Se,{conflicts:we}=ge(),Ee;t[13]===we?Ee=t[14]:(Ee=we.find(sn)?.docName??null,t[13]=we,t[14]=Ee);let De=Ee,Oe;t[15]===n?Oe=t[16]:(Oe=(0,G.jsx)(ut,{status:n}),t[15]=n,t[16]=Oe);let ke;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,G.jsx)(`span`,{className:`text-1sm font-medium`,children:(0,G.jsx)(r,{id:`yZepkk`})}),t[17]=ke):ke=t[17];let Ae;t[18]===Oe?Ae=t[19]:(Ae=(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[Oe,ke]}),t[18]=Oe,t[19]=Ae);let je;t[20]!==s||t[21]!==n.remote?(je=n.remote&&(n.remote.webUrl?(0,G.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-xs text-foreground hover:text-primary hover:underline`,"aria-label":s({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,G.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,G.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs text-foreground`,children:n.remote.label})),t[20]=s,t[21]=n.remote,t[22]=je):je=t[22];let Me;t[23]!==Ae||t[24]!==je?(Me=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[Ae,je]}),t[23]=Ae,t[24]=je,t[25]=Me):Me=t[25];let Pe=x??`full`,Fe;t[26]!==y||t[27]!==O||t[28]!==b||t[29]!==C||t[30]!==Pe?(Fe=(0,G.jsx)(qe,{open:y,onOpenChange:b,onConfirm:O,variant:Pe,strandedCommitCount:C}),t[26]=y,t[27]=O,t[28]=b,t[29]=C,t[30]=Pe,t[31]=Fe):Fe=t[31];let Ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,G.jsx)(Bt,{children:(0,G.jsx)(r,{id:`CnOGgs`})}),t[32]=Ie):Ie=t[32];let Le;t[33]===T?Le=t[34]:(Le=e=>{S(e)&&T(e)},t[33]=T,t[34]=Le);let Re=!u,ze;t[35]===s?ze=t[36]:(ze=s({id:`CnOGgs`}),t[35]=s,t[36]=ze);let Be;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,G.jsx)(h,{}),t[37]=Be):Be=t[37];let Ve;t[38]===ze?Ve=t[39]:(Ve=(0,G.jsx)(m,{size:`sm`,className:`w-full text-xs`,"aria-label":ze,"data-testid":`sync-mode-select`,children:Be}),t[38]=ze,t[39]=Ve);let Ue;t[40]===s?Ue=t[41]:(Ue=s({id:`BWTzAb`}),t[40]=s,t[41]=Ue);let We;t[42]===Ue?We=t[43]:(We=(0,G.jsx)(f,{value:`off`,className:`text-xs`,children:Ue}),t[42]=Ue,t[43]=We);let K;t[44]===s?K=t[45]:(K=s({id:`tlGXxX`}),t[44]=s,t[45]=K);let q;t[46]===K?q=t[47]:(q=(0,G.jsx)(f,{value:`follow`,className:`text-xs`,children:K}),t[46]=K,t[47]=q);let Ge;t[48]===s?Ge=t[49]:(Ge=s({id:`IXiG0B`}),t[48]=s,t[49]=Ge);let Ke;t[50]!==R||t[51]!==Ge?(Ke=(0,G.jsx)(f,{value:`full`,className:`text-xs`,disabled:R,children:Ge}),t[50]=R,t[51]=Ge,t[52]=Ke):Ke=t[52];let Je;t[53]!==We||t[54]!==q||t[55]!==Ke?(Je=(0,G.jsxs)(p,{children:[We,q,Ke]}),t[53]=We,t[54]=q,t[55]=Ke,t[56]=Je):Je=t[56];let Ye;t[57]!==v||t[58]!==Le||t[59]!==Re||t[60]!==Ve||t[61]!==Je?(Ye=(0,G.jsxs)(g,{value:v,onValueChange:Le,disabled:Re,children:[Ve,Je]}),t[57]=v,t[58]=Le,t[59]=Re,t[60]=Ve,t[61]=Je,t[62]=Ye):Ye=t[62];let Ze;t[63]===v?Ze=t[64]:(Ze=(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:v===`off`?(0,G.jsx)(r,{id:`qD3krc`}):v===`follow`?(0,G.jsx)(r,{id:`PGRnbw`}):(0,G.jsx)(r,{id:`zBiFZh`})}),t[63]=v,t[64]=Ze);let Qe;t[65]!==Ye||t[66]!==Ze?(Qe=(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Ie,Ye,Ze]}),t[65]=Ye,t[66]=Ze,t[67]=Qe):Qe=t[67];let J;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,G.jsx)(Bt,{children:(0,G.jsx)(r,{id:`BWTzAb`})}),t[68]=J):J=t[68];let $e=z||xe,et;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>be(`pull`),t[69]=et):et=t[69];let Y;t[70]===V?Y=t[71]:(Y=V===`pull`?(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,G.jsx)(E,{"data-icon":`inline-start`}),t[70]=V,t[71]=Y);let tt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,G.jsx)(r,{id:`e4GHWP`}),t[72]=tt):tt=t[72];let it;t[73]!==$e||t[74]!==Y?(it=(0,G.jsxs)(_,{variant:`outline`,size:`xs`,className:`flex-1`,disabled:$e,onClick:et,"data-testid":`sync-popover-pull`,children:[Y,tt]}),t[73]=$e,t[74]=Y,t[75]=it):it=t[75];let at;t[76]!==z||t[77]!==ue||t[78]!==H||t[79]!==V?(at=ue&&(0,G.jsxs)(_,{variant:`outline`,size:`xs`,className:`flex-1`,disabled:z||H,onClick:()=>be(`push`),"data-testid":`sync-popover-push`,children:[V===`push`?(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,G.jsx)(D,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`uO9WLl`})]}),t[76]=z,t[77]=ue,t[78]=H,t[79]=V,t[80]=at):at=t[80];let X;t[81]!==it||t[82]!==at?(X=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[it,at]}),t[81]=it,t[82]=at,t[83]=X):X=t[83];let Z;t[84]!==z||t[85]!==ue||t[86]!==H||t[87]!==V?(Z=ue&&(0,G.jsxs)(_,{size:`xs`,className:`w-full`,disabled:z||H,onClick:()=>be(`sync`),"data-testid":`sync-popover-sync`,children:[V===`sync`?(0,G.jsx)(j,{"aria-hidden":`true`,icon:M,"data-icon":`inline-start`}):(0,G.jsx)(M,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`YEzhIr`})]}),t[84]=z,t[85]=ue,t[86]=H,t[87]=V,t[88]=Z):Z=t[88];let ot;t[89]!==X||t[90]!==Z?(ot=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t pt-3`,children:[J,X,Z]}),t[89]=X,t[90]=Z,t[91]=ot):ot=t[91];let st;if(t[92]!==s||t[93]!==n){let e;t[95]===s?e=t[96]:(e=e=>(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:e.direction===`push`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[s({id:`uO9WLl`}),`: `]}),e.message]}):e.direction===`pull`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[s({id:`e4GHWP`}),`: `]}),e.message]}):e.message},e.key),t[95]=s,t[96]=e),st=It(n).map(e),t[92]=s,t[93]=n,t[94]=st}else st=t[94];let Q;t[97]===n?Q=t[98]:(Q=Dt(n)&&n.pushPermission?.checkStatus===`denied`?wt(n.pushPermission).map(on):null,t[97]=n,t[98]=Q);let ct;t[99]!==n.pausedReason||t[100]!==n.pushPermission?(ct=n.pausedReason===`no-push-permission`&&n.pushPermission?.checkStatus===`denied`?wt(n.pushPermission).map(an):null,t[99]=n.pausedReason,t[100]=n.pushPermission,t[101]=ct):ct=t[101];let $;t[102]!==st||t[103]!==Q||t[104]!==ct?($=(0,G.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-col gap-3.5 empty:sr-only`,"data-testid":`sync-popover-status`,children:[st,Q,ct]}),t[102]=st,t[103]=Q,t[104]=ct,t[105]=$):$=t[105];let dt;t[106]!==Ce||t[107]!==I||t[108]!==R||t[109]!==a||t[110]!==n?(dt=!I&&Ot(n.pushPermission)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`ycIX5i`})}),a&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):Ce.length>0?(0,G.jsx)(Xe,{paths:Ce}):Dt(n)?null:n.pausedReason?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(St,{reason:n.pausedReason})}),(0,G.jsx)(bt,{paths:n.refusedSymlinkPaths})]}):!I&&R&&n.pushPermission?.checkStatus===`denied`?Ct(n.pushPermission.deniedReason,n.pushPermission).map(rn):Lt(n.pushPermission)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`C_cPoW`})}),a&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):null,t[106]=Ce,t[107]=I,t[108]=R,t[109]=a,t[110]=n,t[111]=dt):dt=t[111];let ft;t[112]!==De||t[113]!==L?(ft=L===`conflict`&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-amber-700 dark:text-amber-400`,children:(0,G.jsx)(r,{id:`ko386X`})}),De!==null&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>rt(de(De)),children:(0,G.jsx)(r,{id:`5k0NLb`})})]}),t[112]=De,t[113]=L,t[114]=ft):ft=t[114];let pt;t[115]!==le||t[116]!==a||t[117]!==L||t[118]!==n?(pt=L===`auth-error`&&!Dt(n)&&(le?a&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-destructive`,children:(0,G.jsx)(r,{id:`Vl1H8I`})}),(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):jt(n.remote)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-destructive`,"data-testid":`sync-popover-auth-error-unverified`,children:(0,G.jsx)(r,{id:`FioJgb`})}),(0,G.jsx)($t,{})]}):(0,G.jsx)(`p`,{className:`text-xs text-destructive`,"data-testid":`sync-popover-auth-error-no-token`,children:(0,G.jsx)(r,{id:`w-Wt3H`})})),t[115]=le,t[116]=a,t[117]=L,t[118]=n,t[119]=pt):pt=t[119];let mt;t[120]===c?mt=t[121]:(mt=c>0&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`B4_ipX`,values:{conflictCount:c}})}),t[120]=c,t[121]=mt);let ht;t[122]!==n||t[123]!==k||t[124]!==F||t[125]!==A||t[126]!==P||t[127]!==N?(ht=(0,G.jsx)(Zt,{status:n,worktree:k,loading:A,unreadable:N,stale:P,lastReadAt:F}),t[122]=n,t[123]=k,t[124]=F,t[125]=A,t[126]=P,t[127]=N,t[128]=ht):ht=t[128];let gt;t[129]!==se||t[130]!==ae||t[131]!==oe?(gt=(0,G.jsx)(Qt,{pulledAt:ae,pushedAt:oe,combinedAt:se}),t[129]=se,t[130]=ae,t[131]=oe,t[132]=gt):gt=t[132];let _t;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsxs)(_,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs text-muted-foreground hover:font-medium hover:text-foreground hover:no-underline`,onClick:nn,"data-testid":`sync-popover-settings`,children:[(0,G.jsx)(te,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`VNgKZz`})]})}),t[133]=_t):_t=t[133];let vt;t[134]===gt?vt=t[135]:(vt=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[gt,_t]}),t[134]=gt,t[135]=vt);let yt;t[136]!==o||t[137]!==n.identityUnresolved?(yt=n.identityUnresolved&&o&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,G.jsx)(Te,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:(0,G.jsx)(r,{id:`nrGWJ7`})}),(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:o,children:(0,G.jsx)(r,{id:`keNFEd`})})]})]}),t[136]=o,t[137]=n.identityUnresolved,t[138]=yt):yt=t[138];let xt;return t[139]!==Me||t[140]!==Fe||t[141]!==Qe||t[142]!==ot||t[143]!==$||t[144]!==dt||t[145]!==ft||t[146]!==pt||t[147]!==mt||t[148]!==ht||t[149]!==vt||t[150]!==yt?(xt=(0,G.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[Me,Fe,Qe,ot,$,dt,ft,pt,mt,ht,vt,yt]}),t[139]=Me,t[140]=Fe,t[141]=Qe,t[142]=ot,t[143]=$,t[144]=dt,t[145]=ft,t[146]=pt,t[147]=mt,t[148]=ht,t[149]=vt,t[150]=yt,t[151]=xt):xt=t[151],xt}function nn(){return ce({advanced:!0})}function rn(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function an(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function on(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function sn(e){return e.docName!==null}function cn(e){let t=(0,U.c)(68),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:a,onSetIdentity:l}=n,{_:u}=i(),{status:d,fetchError:f}=he();if(!d){if(f){let e;t[2]===u?e=t[3]:(e=u({id:`iqIDv4`}),t[2]=u,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(xe,{className:`size-3.5`}),t[4]=n):n=t[4];let i;t[5]===e?i=t[6]:(i=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=i);let a;t[7]===f?a=t[8]:(a=(0,G.jsx)(s,{children:f===`network`?(0,G.jsx)(r,{id:`I5AfhE`}):(0,G.jsx)(r,{id:`uKRYiW`})}),t[7]=f,t[8]=a);let l;return t[9]!==i||t[10]!==a?(l=(0,G.jsxs)(c,{children:[i,a]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}return null}if(!d.hasRemote)return null;let p;t[12]===d?p=t[13]:(p=dt(d),t[12]=d,t[13]=p);let m=p,h,g,v,y,b,x,S,C,w,T,E,D;if(t[14]!==u||t[15]!==d){let e=Rt(d);x=!!d.identityUnresolved,b=me,y=c,v=o,D=!0,g=z,E=!0,h=_,S=`ghost`,C=`icon-sm`,w=`text-muted-foreground relative`,T=u(x?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=u,t[15]=d,t[16]=h,t[17]=g,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D}else h=t[16],g=t[17],v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27];let ee;t[28]===d?ee=t[29]:(ee=(0,G.jsx)(ut,{status:d}),t[28]=d,t[29]=ee);let O;t[30]===m?O=t[31]:(O=m&&(0,G.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:m}),t[30]=m,t[31]=O);let k;t[32]!==m||t[33]!==x?(k=!m&&x&&(0,G.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[32]=m,t[33]=x,t[34]=k):k=t[34];let te;t[35]!==h||t[36]!==O||t[37]!==k||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==T||t[42]!==ee?(te=(0,G.jsxs)(h,{variant:S,size:C,className:w,"aria-label":T,children:[ee,O,k]}),t[35]=h,t[36]=O,t[37]=k,t[38]=S,t[39]=C,t[40]=w,t[41]=T,t[42]=ee,t[43]=te):te=t[43];let A;t[44]!==g||t[45]!==te||t[46]!==E?(A=(0,G.jsx)(g,{asChild:E,children:te}),t[44]=g,t[45]=te,t[46]=E,t[47]=A):A=t[47];let j;t[48]!==v||t[49]!==A||t[50]!==D?(j=(0,G.jsx)(v,{asChild:D,children:A}),t[48]=v,t[49]=A,t[50]=D,t[51]=j):j=t[51];let M;t[52]===d?M=t[53]:(M=zt(d),t[52]=d,t[53]=M);let N;t[54]===M?N=t[55]:(N=(0,G.jsx)(s,{children:M}),t[54]=M,t[55]=N);let P;t[56]!==y||t[57]!==j||t[58]!==N?(P=(0,G.jsxs)(y,{children:[j,N]}),t[56]=y,t[57]=j,t[58]=N,t[59]=P):P=t[59];let F;t[60]!==l||t[61]!==a||t[62]!==d?(F=(0,G.jsx)(fe,{align:`end`,className:`flex max-h-(--radix-popover-content-available-height) w-80 flex-col overflow-y-auto p-3`,children:(0,G.jsx)(tn,{status:d,onSignIn:a,onSetIdentity:l})}),t[60]=l,t[61]=a,t[62]=d,t[63]=F):F=t[63];let I;return t[64]!==b||t[65]!==P||t[66]!==F?(I=(0,G.jsxs)(b,{children:[P,F]}),t[64]=b,t[65]=P,t[66]=F,t[67]=I):I=t[67],I}export{je as C,V as E,ke as S,H as T,q as _,wt as a,Oe as b,Et as c,$ as d,jt as f,K as g,qe as h,lt as i,kt as l,Lt as m,bt as n,Ft as o,Ot as p,cn as r,At as s,St as t,Dt as u,Pe as v,De as w,Ee as x,Ae as y};
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{i as o,n as s,t as c}from"./tooltip-DBqLYfio.js";import{n as l,r as u,t as d}from"./collapsible-BKbszYZV.js";import{i as f,n as p,o as m,s as h,t as g}from"./select-Bu4Wm3Rf.js";import{t as _}from"./button-DzgjsZzC.js";import{n as v}from"./dist-BGzUo_18.js";import{t as y}from"./dist-C_FzPxEX2.js";import{n as b}from"./config-errors-DCSQBhyj.js";import{v as x}from"./documents-events-C04vpPEp.js";import{f as S,h as C}from"./share-D-LUU2aX-DfD-mrg-.js";import{i as w}from"./use-apply-config-theme-CYFG76sS.js";import{t as T}from"./createLucideIcon-DdBzwsHe.js";import{n as E,t as D}from"./arrow-up-BGHhPj4y.js";import{t as ee}from"./arrow-up-right-nJaICi16.js";import{t as O}from"./chevron-right-Bofu4lib.js";import{n as k,t as te}from"./settings-2-DoBlNQMk.js";import{t as A}from"./git-merge-VDBzSZBV.js";import{t as j}from"./spinner-Bx8xD6f8.js";import{t as M}from"./refresh-cw-CC7UZEnZ.js";import{t as N}from"./terminal-Cpb4l1oH.js";import{t as P}from"./triangle-alert-BXrUEeRU.js";import{t as F}from"./badge-DmdA1C7r.js";import{a as I,c as ne,i as L,n as re,o as ie,r as ae,s as oe,t as se}from"./dialog-BJEjKJjL.js";import{a as R,l as ce}from"./use-settings-route-DT86DJkF.js";import{c as le,h as ue,l as de}from"./doc-hash-BJkweiX9.js";import"./config-provider-DBgrt1kx.js";import{a as z,i as fe,r as pe,t as me}from"./popover-BhiLJhH5.js";import{n as he}from"./use-git-sync-status-BQYF2F5Z.js";import{n as ge}from"./use-conflicts-CpABgIGI.js";import{n as B,t as _e}from"./DisclosureWarning-DGH1_U0o.js";import{t as ve}from"./terminal-command-events-DylLB9_L.js";var V=T(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),ye=T(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),be=T(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),xe=T(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),H=T(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Se=T(`git-commit-vertical`,[[`path`,{d:`M12 3v6`,key:`1holv5`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M12 15v6`,key:`a9ows0`}]]),Ce=T(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),we=T(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Te=T(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),U=a(),W=e(n(),1);function Ee(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=e?`full`:`off`,r=t.patch({autoSync:{mode:n,enabled:e}});return r.ok?{ok:!0}:{ok:!1,error:b(r.error)}},e[0]=t,e[1]=r),r}function De(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:{mode:e,enabled:null}});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Oe(){let e=(0,U.c)(2),{projectBinding:t,projectSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:{default:e}});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function ke(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Ae(e,t){let n=(0,U.c)(12),{_:r}=i(),[a,o]=(0,W.useState)(!1),s;n[0]!==r||n[1]!==e?(s=function(t){if(e===null)return v.info(r({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let n=e(t);if(!n.ok){console.error(`[sync] toggle failed:`,n.error);let e=n.error;return v.error(r(t?{id:`04RA0-`,values:{detail:e}}:{id:`qjHMHf`,values:{detail:e}})),!1}return!0},n[0]=r,n[1]=e,n[2]=s):s=n[2];let c=s,l;n[3]===c?l=n[4]:(l=function(e){if(e){o(!0);return}c(!1)},n[3]=c,n[4]=l);let u=l,d;n[5]!==c||n[6]!==t?(d=function(){c(!0)&&(o(!1),t?.onEnabled?.())},n[5]=c,n[6]=t,n[7]=d):d=n[7];let f=d,p;return n[8]!==a||n[9]!==f||n[10]!==u?(p={confirmOpen:a,setConfirmOpen:o,onToggleRequest:u,onConfirm:f},n[8]=a,n[9]=f,n[10]=u,n[11]=p):p=n[11],p}function je(e,t,n){let r=(0,U.c)(15),{_:a}=i(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),u;r[0]!==a||r[1]!==n||r[2]!==e?(u=function(t){if(e===null)return v.info(a({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let r=e(t);if(!r.ok){console.error(`[sync] mode change failed:`,r.error);let e=r.error;return v.error(a({id:`nOEDQs`,values:{detail:e}})),!1}return n?.onApplied?.(t),!0},r[0]=a,r[1]=n,r[2]=e,r[3]=u):u=r[3];let d=u,f;r[4]!==d||r[5]!==t?(f=function(e){if(e!==t){if(e===`off`){d(`off`);return}l(e),s(!0)}},r[4]=d,r[5]=t,r[6]=f):f=r[6];let p=f,m;r[7]!==d||r[8]!==c?(m=function(){c!==null&&d(c)&&s(!1)},r[7]=d,r[8]=c,r[9]=m):m=r[9];let h=m,g;return r[10]!==o||r[11]!==h||r[12]!==p||r[13]!==c?(g={confirmOpen:o,setConfirmOpen:s,pendingMode:c,onModeSelect:p,onConfirm:h},r[10]=o,r[11]=h,r[12]=p,r[13]=c,r[14]=g):g=r[14],g}function Me(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Ne(e,t){let n=(0,U.c)(18),{_:r}=i(),a=Me(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),u;n[0]===e?u=n[1]:(u=C(e)??`off`,n[0]=e,n[1]=u);let d=u,f;n[2]!==r||n[3]!==a?(f=function(e){if(a===null)return v.info(r({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let t=a(e);if(!t.ok){console.error(`[sync] badge control failed:`,t.error);let e=t.error;return v.error(r({id:`ZVOhXM`,values:{detail:e}})),!1}return!0},n[2]=r,n[3]=a,n[4]=f):f=n[4];let p=f,m;n[5]!==p||n[6]!==d?(m=function(e){if(e!==d){if(e===`off`){p({mode:`off`,enabled:null,resumeMode:null});return}l(e),s(!0)}},n[5]=p,n[6]=d,n[7]=m):m=n[7];let h=m,g;n[8]!==p||n[9]!==c?(g=function(){c!==null&&p({mode:c,enabled:null,resumeMode:null})&&(s(!1),l(null))},n[8]=p,n[9]=c,n[10]=g):g=n[10];let _=g,y=c===`follow`?t:0,b;return n[11]!==o||n[12]!==d||n[13]!==_||n[14]!==h||n[15]!==c||n[16]!==y?(b={mode:d,confirmOpen:o,setConfirmOpen:s,pendingMode:c,strandedCommitCount:y,onModeSelect:h,onConfirm:_},n[11]=o,n[12]=d,n[13]=_,n[14]=h,n[15]=c,n[16]=y,n[17]=b):b=n[17],b}async function Pe(e){let t=await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})});if(!t.ok)throw Error(`sync trigger failed: ${t.status}`)}var Fe=5e3,Ie=15e3,Le=3e4,Re=0;function ze(){let e=Date.now();e-Re<Le||(Re=e,Pe(`fetch`).catch(()=>{Re===e&&(Re=0)}))}async function Be(e){try{let t=await fetch(`/api/git/worktree-status`,{signal:e});if(!t.ok)return console.warn(`[sync] worktree status read failed: http`,t.status),{kind:`failed`,reason:`http`};let n=await t.json();return n.readable===!1?{kind:`unreadable`}:{kind:`ok`,status:n}}catch(t){return e.aborted?{kind:`failed`,reason:`aborted`}:(console.warn(`[sync] worktree status read failed: network`,t instanceof Error?t.message:t),{kind:`failed`,reason:`network`})}}var Ve={status:null,unreadable:!1,stale:!1,lastReadAt:null};function He(e){let t=(0,U.c)(9),[n,r]=(0,W.useState)(Ve),i,a;t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!1,n=!1,i=!1,a=null;function o(){if(n){i=!0;return}n=!0;let e=new AbortController;a=e;let s=setTimeout(()=>e.abort(),Ie);Be(e.signal).then(e=>{if(!t){if(e.kind===`ok`){r({status:e.status,unreadable:!1,stale:!1,lastReadAt:Date.now()});return}if(e.kind===`unreadable`){r(We);return}r(Ue)}}).finally(()=>{clearTimeout(s),a===e&&(a=null),n=!1,i&&!t&&(i=!1,o())})}o(),ze();let s=setInterval(o,Fe),c=x(e=>{e.includes(`sync-status`)&&o()});return()=>{t=!0,clearInterval(s),c(),a?.abort()}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,W.useEffect)(i,a);let o=e&&n.status===null&&!n.unreadable,s;return t[3]!==n.lastReadAt||t[4]!==n.stale||t[5]!==n.status||t[6]!==n.unreadable||t[7]!==o?(s={status:n.status,loading:o,unreadable:n.unreadable,stale:n.stale,lastReadAt:n.lastReadAt},t[3]=n.lastReadAt,t[4]=n.stale,t[5]=n.status,t[6]=n.unreadable,t[7]=o,t[8]=s):s=t[8],s}function Ue(e){return e.status===null?e.unreadable?e:{...e,unreadable:!0,stale:!1}:e.unreadable||e.stale?e:{...e,stale:!0}}function We(e){return{...e,unreadable:!0,stale:!1}}var G=t();function K(e){let t=(0,U.c)(4),{variant:n}=e;if((n===void 0?`full`:n)===`follow`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(ne,{children:(0,G.jsx)(r,{id:`W7mERj`})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(G.Fragment,{children:[e,(0,G.jsx)(I,{children:(0,G.jsx)(r,{id:`KmVekT`})})]}),t[1]=n):n=t[1],n}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(ne,{children:(0,G.jsx)(r,{id:`Uo2Rj7`})}),t[2]=i):i=t[2];let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsxs)(G.Fragment,{children:[i,(0,G.jsx)(I,{children:(0,G.jsx)(r,{id:`n6hXUm`})})]}),t[3]=a):a=t[3],a}function q(e){let t=(0,U.c)(2),{variant:n}=e,r=n===void 0?`full`:n,i;return t[0]===r?i=t[1]:(i=(0,G.jsx)(_e,{children:r===`follow`?(0,G.jsx)(Ke,{}):(0,G.jsx)(Ge,{})}),t[0]=r,t[1]=i),i}function Ge(){let e=(0,U.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(B,{icon:(0,G.jsx)(ye,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`cdmk8A`}),body:(0,G.jsx)(r,{id:`YaeyFh`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(B,{icon:(0,G.jsx)(Se,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`9i21pa`}),body:(0,G.jsx)(r,{id:`KIIamL`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsxs)(G.Fragment,{children:[t,n,(0,G.jsx)(B,{icon:(0,G.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`8cpeU3`}),body:(0,G.jsx)(r,{id:`DELNQk`})})]}),e[2]=i):i=e[2],i}function Ke(){let e=(0,U.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(B,{icon:(0,G.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`0xnQ_X`}),body:(0,G.jsx)(r,{id:`aCoQfY`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(B,{icon:(0,G.jsx)(Ce,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`5rnB76`}),body:(0,G.jsx)(r,{id:`kXNv8P`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsxs)(G.Fragment,{children:[t,n,(0,G.jsx)(B,{icon:(0,G.jsx)(A,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`oBK5fD`}),body:(0,G.jsx)(r,{id:`8Wav8y`})})]}),e[2]=i):i=e[2],i}function qe(e){let t=(0,U.c)(24),{open:n,onOpenChange:i,onConfirm:a,variant:o,strandedCommitCount:s}=e,c=o===void 0?`full`:o,l=s===void 0?0:s,u=c===`follow`&&l>0,d;t[0]===c?d=t[1]:(d=(0,G.jsx)(oe,{children:(0,G.jsx)(K,{variant:c})}),t[0]=c,t[1]=d);let f;t[2]===c?f=t[3]:(f=(0,G.jsx)(q,{variant:c}),t[2]=c,t[3]=f);let p;t[4]!==u||t[5]!==l?(p=u&&(0,G.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:(0,G.jsx)(r,{id:`caw8gO`,values:{strandedCommitCount:l}})}),t[4]=u,t[5]=l,t[6]=p):p=t[6];let m;t[7]!==f||t[8]!==p?(m=(0,G.jsxs)(re,{children:[f,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(ae,{asChild:!0,children:(0,G.jsx)(_,{variant:`outline`,children:(0,G.jsx)(r,{id:`dEgA5A`})})}),t[10]=h):h=t[10];let g;t[11]===c?g=t[12]:(g=c===`follow`?(0,G.jsx)(r,{id:`jTUxaN`}):(0,G.jsx)(r,{id:`pPiV8s`}),t[11]=c,t[12]=g);let v;t[13]!==a||t[14]!==g?(v=(0,G.jsxs)(ie,{children:[h,(0,G.jsx)(_,{onClick:a,children:g})]}),t[13]=a,t[14]=g,t[15]=v):v=t[15];let y;t[16]!==d||t[17]!==m||t[18]!==v?(y=(0,G.jsxs)(L,{className:`sm:max-w-lg`,children:[d,m,v]}),t[16]=d,t[17]=m,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==i||t[21]!==n||t[22]!==y?(b=(0,G.jsx)(se,{open:n,onOpenChange:i,children:y}),t[20]=i,t[21]=n,t[22]=y,t[23]=b):b=t[23],b}async function Je(e){let t=await fetch(`/api/sync/resolve-blocking`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:e})});if(!t.ok)throw Error(`sync resolve-blocking failed: ${t.status}`)}function Ye(){return typeof window<`u`&&window.okDesktop!=null}function Xe(e){let t=(0,U.c)(23),{paths:n}=e,[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(!1);if(n.length===0)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=async function(e){a(e),s(!1);try{await Je(e),a(null)}catch{s(!0),a(null)}},t[0]=c):c=t[0];let l=c,u=i!==null,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(`span`,{id:`sync-blocking-heading`,className:`text-xs font-medium text-foreground`,children:(0,G.jsx)(r,{id:`sdvHp3`})}),t[1]=d):d=t[1];let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[d,(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`H4doZt`})})]}),t[2]=f):f=t[2];let p;t[3]===n?p=t[4]:(p=n.map(Qe),t[3]=n,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,G.jsx)(`ul`,{"aria-labelledby":`sync-blocking-heading`,className:`flex max-h-28 flex-col gap-1 overflow-y-auto overscroll-contain`,"data-testid":`sync-blocking-list`,children:p}),t[5]=p,t[6]=m);let h;t[7]===o?h=t[8]:(h=o&&(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`sync-blocking-error`,children:(0,G.jsx)(r,{id:`FsEXax`})}),t[7]=o,t[8]=h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>void l(`commit`),t[9]=g):g=t[9];let v;t[10]===i?v=t[11]:(v=i===`commit`&&(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}),t[10]=i,t[11]=v);let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsx)(r,{id:`N7Lau6`}),t[12]=y):y=t[12];let b;t[13]!==u||t[14]!==v?(b=(0,G.jsxs)(_,{size:`xs`,disabled:u,onClick:g,"data-testid":`sync-blocking-commit`,children:[v,y]}),t[13]=u,t[14]=v,t[15]=b):b=t[15];let x;t[16]===u?x=t[17]:(x=Ye()&&(0,G.jsxs)(_,{variant:`link-muted`,size:`xs`,className:`self-start p-0`,disabled:u,onClick:Ze,"data-testid":`sync-blocking-terminal`,children:[(0,G.jsx)(N,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`6EoD0z`})]}),t[16]=u,t[17]=x);let S;return t[18]!==b||t[19]!==x||t[20]!==m||t[21]!==h?(S=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t pt-3`,children:[f,m,h,b,x]}),t[18]=b,t[19]=x,t[20]=m,t[21]=h,t[22]=S):S=t[22],S}function Ze(){return ve(`git-status`)}function Qe(e){return(0,G.jsx)(`li`,{title:e,className:`min-w-0 truncate font-mono text-2xs text-foreground`,children:e},e)}function J(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function $e(e){return e===``?[]:e.split(`/`)}function et(e){if(e.length===0)return``;let t=$e(J(e[0]));for(let n of e.slice(1)){let e=$e(J(n)),r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];)r++;if(t=t.slice(0,r),t.length===0)break}return t.join(`/`)}function Y(e,t){return e===``?t:t.slice(e.length+1)}function tt(e,t=8){if(e.length===0)return{prefix:``,groups:[],loose:[]};if(e.length===1)return{prefix:``,groups:[],loose:[{entry:e[0],label:e[0].path}]};let n=et(e.map(e=>e.path)),r=e.map(e=>{let t=Y(n,e.path);return{entry:e,rel:t,key:J(t)}}),i=()=>new Set(r.map(e=>e.key));for(;i().size>t;){let e=Math.max(...r.map(e=>$e(e.key).length));if(e===0)break;for(let t of r)$e(t.key).length===e&&(t.key=J(t.key))}let a=new Map;for(let{entry:e,rel:t,key:n}of r){let r=a.get(n)??[];r.push({entry:e,label:n===``?t:t.slice(n.length+1)}),a.set(n,r)}let o=[],s=[];for(let[e,t]of a)if(e===``||t.length===1)for(let e of t)s.push({entry:e.entry,label:Y(n,e.entry.path)});else o.push({dir:e,rows:t});return o.sort((e,t)=>t.rows.length-e.rows.length||e.dir.localeCompare(t.dir)),s.sort((e,t)=>e.entry.path.localeCompare(t.entry.path)),{prefix:n,groups:o,loose:s}}function nt(e=`sync`,t){Pe(e).catch(e=>{console.warn(`[sync-badge] manual sync trigger failed`,e instanceof Error?e.message:e),t?.()})}function rt(e){typeof window>`u`||ue(window.location.hash,e)||(window.location.hash=e)}function it(e){return e.kind===`doc`?de(e.docName):le(e.path)}var at=3e4;function X(e,t,n){let r=n-t;return r<6e4?e({id:`xOTzt5`}):r<36e5?e({id:`_rP3HI`,values:{minutes:Math.floor(r/6e4)}}):r<864e5?e({id:`nYeBmY`,values:{hours:Math.floor(r/36e5)}}):new Date(t).toLocaleDateString()}function Z(e,t){return X(e,new Date(t).getTime(),Date.now())}function ot(){let e=(0,U.c)(2),[t,n]=(0,W.useState)(st),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=setInterval(()=>n(Date.now()),at);return()=>clearInterval(e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,W.useEffect)(r,i),t}function st(){return Date.now()}function Q(e){return e.syncMode===`follow`}var ct=[`git-operation-in-progress`,`unsafe-incoming-symlinks`];function $(e){return ct.includes(e)}function lt(e){return e.state===`idle`&&e.conflictCount>0?`conflict`:(e.state===`idle`||e.state===`offline`)&&$(e.pausedReason)?`disabled`:e.state}function ut(e){let t=(0,U.c)(12),{status:n}=e;switch(lt(n)){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(H,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(M,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(H,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(j,{"aria-hidden":`true`,icon:M,className:`size-3.5 text-muted-foreground`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(P,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(xe,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===n?e=t[7]:(e=Et(n)?(0,G.jsx)(be,{className:`size-3.5 text-destructive`}):(0,G.jsx)(we,{className:`size-3.5 text-destructive`}),t[6]=n,t[7]=e),e}case`disabled`:{if(n.pausedReason){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(P,{className:`size-3.5 text-amber-500`}),t[8]=e):e=t[8],e}if(n.ahead>0||n.behind>0){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(M,{className:`size-3.5 text-muted-foreground`}),t[9]=e):e=t[9],e}let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(H,{className:`size-3.5 text-muted-foreground`}),t[10]=e):e=t[10],e}default:{let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(H,{className:`size-3.5 text-muted-foreground`}),t[11]=e):e=t[11],e}}}function dt(e){switch(lt(e)){case`idle`:return!Q(e)&&e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function ft(e){let t=Q(e),n=lt(e);switch(n){case`dormant`:return y._({id:`RmBY0A`});case`idle`:return t?y._({id:`j5CWO4`}):y._({id:`N2FcBE`});case`fetching`:return t?y._({id:`7IsvrP`}):y._({id:`Wgmlsw`});case`pulling`:return t?y._({id:`JL3si7`}):y._({id:`4uNLmk`});case`pushing`:return y._({id:`iycx_A`});case`conflict`:return y._({id:`IInnZo`});case`offline`:return y._({id:`6Aih4U`});case`auth-error`:return y._({id:`mHVPm5`});case`disabled`:return e.pausedReason?y._({id:`U6wmNc`}):y._({id:`BWTzAb`});default:return n}}var pt=[`git-index-locked`],mt={"git-index-locked":{id:`sOcMdy`},"git-operation-in-progress":{id:`mJTr6D`},"external-changes-pending":{id:`W9_Bub`},"dirty-tree":{id:`a5Gha5`},"non-content-merge-failure":{id:`sIxSSP`},"detached-head":{id:`uQNW00`},"diverged-local-commits":{id:`LQsCPn`},"auth-error":{id:`mHVPm5`},"protected-branch":{id:`8fc_3j`},"no-push-permission":{id:`EiVgl5`},"no-commits-yet":{id:`-ZVU5v`},"unsafe-incoming-symlinks":{id:`8qsUJv`}};function ht(e){return Object.hasOwn(mt,e)}function gt(e,t){return ht(t)?e(mt[t]):t}function _t(e){return pt.includes(e)}function vt(e){throw Error(`Unhandled node-rendered paused reason: ${String(e)}`)}function yt(e){let t=(0,U.c)(3),{reason:n}=e;switch(n){case`git-index-locked`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(r,{id:`Qca--K`,components:{0:(0,G.jsx)(`span`,{dir:`ltr`,className:`font-mono`})}}),t[0]=e):e=t[0],e}default:{let e;return t[1]===n?e=t[2]:(e=vt(n),t[1]=n,t[2]=e),e}}}function bt(e){let t=(0,U.c)(4),{paths:n}=e;if(n===void 0||n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(xt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,G.jsx)(`ul`,{className:`flex max-h-28 flex-col gap-1 overflow-y-auto overscroll-contain`,"data-testid":`sync-refused-symlinks`,children:r}),t[2]=r,t[3]=i),i}function xt(e){return(0,G.jsx)(`li`,{title:e,dir:`ltr`,className:`min-w-0 truncate font-mono text-2xs text-foreground`,children:e},e)}function St(e){let t=(0,U.c)(7),{reason:n}=e,{_:r}=i();if(_t(n)){let e;return t[0]===n?e=t[1]:(e=(0,G.jsx)(yt,{reason:n}),t[0]=n,t[1]=e),e}let a;t[2]!==r||t[3]!==n?(a=gt(r,n),t[2]=r,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,G.jsx)(G.Fragment,{children:a}),t[5]=a,t[6]=o),o}function Ct(e,t){let n=[];switch(e){case`not-authenticated`:n.push(y._({id:`ycIX5i`}));break;case`no-collaborator`:n.push(y._({id:`EiVgl5`}));break;case`private-no-access`:n.push(y._({id:`07gHun`}));break;case`repo-not-found`:n.push(y._({id:`uksqrP`}));break;default:n.push(y._({id:`EiVgl5`}))}return n.push(...wt(t)),n}function wt(e){let t=[];if(e?.resolvedLogin){let n=e.resolvedLogin;t.push(y._({id:`ZKVuLY`,values:{login:n}}))}return e?.declaredLogin&&t.push(Tt(e.declaredLogin,e.declaredSource)),t}function Tt(e,t){switch(t){case`remote-url`:return y._({id:`CMd-g-`,values:{declaredLogin:e}});case`credential-config`:return y._({id:`akOe4q`,values:{declaredLogin:e}});default:return y._({id:`GBEqoP`,values:{declaredLogin:e}})}}function Et(e){return e.pushErrorCode===`auth-not-found-as-identity`||e.pullErrorCode===`auth-not-found-as-identity`}function Dt(e){return e?.pausedReason===`auth-error`&&Et(e)}function Ot(e){return e?.checkStatus===`denied`&&e.deniedReason===`not-authenticated`}function kt(e){return typeof e?.webUrl==`string`}function At(e){return e!=null&&!kt(e)}function jt(e){return e?.transport===void 0||e.transport===`https`}function Mt(e,t){switch(e){case`auth-401`:return t?y._({id:`-Qw-1t`}):y._({id:`LVWA9A`});case`auth-scope-mismatch`:return t?y._({id:`Zue_jx`}):y._({id:`yLyiQV`});case`auth-no-credential`:return t?y._({id:`uCaIdy`}):y._({id:`xJ7qrb`});default:return null}}function Nt(e,t){let n=Mt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`EiVgl5`});case`semantic-protected-branch`:return y._({id:`T0OVm7`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`1AumWo`})}}function Pt(e,t){let n=Mt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`RgbKEe`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`jZ_E5M`})}}function Ft(e,t){let n=Mt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`RgbKEe`});case`semantic-protected-branch`:return y._({id:`T0OVm7`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`cUk6TF`})}}function It(e){let t=kt(e.remote),n=e.pushErrorCode!=null||e.pushError!=null,r=e.pullErrorCode!=null||e.pullError!=null;if(n&&r&&(e.pushErrorCode==null?e.pullErrorCode==null&&e.pushError===e.pullError:e.pushErrorCode===e.pullErrorCode))return[{key:`sync`,direction:null,message:e.pushErrorCode==null?e.pushError:Ft(e.pushErrorCode,t)}];let i=n&&r,a=[];return n&&a.push({key:`push`,direction:i?`push`:null,message:e.pushErrorCode?Nt(e.pushErrorCode,t):e.pushError}),r&&a.push({key:`pull`,direction:i?`pull`:null,message:e.pullErrorCode?Pt(e.pullErrorCode,t):e.pullError}),a}function Lt(e){return e?.checkStatus===`unknown`&&e.unknownError===`token-invalid`}function Rt(e){return lt(e)===`auth-error`&&Et(e)?y._({id:`EkEFE3`}):ft(e)}function zt(e){let t=Q(e),n=lt(e);if(n===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return y._({id:`cUK8lW`,values:{conflictCount:t}})}if(n===`idle`){let{ahead:n,behind:r}=e;return t?r>0?y._({id:`9o1bIV`,values:{behind:r}}):y._({id:`j5CWO4`}):n>0&&r>0?y._({id:`5F5HYj`,values:{ahead:n,behind:r}}):n>0?y._({id:`PdA9NZ`,values:{ahead:n}}):r>0?y._({id:`9o1bIV`,values:{behind:r}}):y._({id:`N2FcBE`})}return Rt(e)}function Bt(e){let t=(0,U.c)(3),{children:n,id:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,G.jsx)(`span`,{id:r,className:`font-mono uppercase tracking-wide text-2xs text-muted-foreground`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Vt(e){switch(e){case`M`:return y._({id:`tgWuMB`});case`A`:return y._({id:`hp8OtS`});case`D`:return y._({id:`vGjmyl`});case`R`:return y._({id:`QeREu8`});case`C`:return y._({id:`6V3Ea3`});case`U`:return y._({id:`cyoNqf`});case`T`:return y._({id:`zWZBPx`});case`?`:return y._({id:`C2abof`});case`!`:return y._({id:`xDKOFk`});default:return y._({id:`cNsIJf`})}}function Ht(e){switch(e){case`D`:return`destructive`;case`U`:return`warning`;default:return`gray`}}function Ut(e){let t=(0,U.c)(25),{entry:n,dimmed:r,label:i}=e,a;t[0]===n.code?a=t[1]:(a=Vt(n.code),t[0]=n.code,t[1]=a);let l=a,u=n.open,d=`truncate text-start font-mono text-2xs ${r?`text-muted-foreground/60`:`text-foreground`}`,f;t[2]===n.code?f=t[3]:(f=Ht(n.code),t[2]=n.code,t[3]=f);let p;t[4]===n.code?p=t[5]:(p=(0,G.jsx)(`span`,{"aria-hidden":!0,children:n.code}),t[4]=n.code,t[5]=p);let m;t[6]===l?m=t[7]:(m=(0,G.jsx)(`span`,{className:`sr-only`,children:l}),t[6]=l,t[7]=m);let h;t[8]!==f||t[9]!==p||t[10]!==m?(h=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsxs)(F,{variant:f,className:`size-4 shrink-0 justify-center p-0 text-2xs leading-none`,children:[p,m]})}),t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===l?g=t[13]:(g=(0,G.jsx)(s,{children:l}),t[12]=l,t[13]=g);let v;t[14]!==h||t[15]!==g?(v=(0,G.jsxs)(c,{children:[h,g]}),t[14]=h,t[15]=g,t[16]=v):v=t[16];let y;t[17]!==n.path||t[18]!==i||t[19]!==u||t[20]!==d?(y=u?(0,G.jsxs)(c,{children:[(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(_,{variant:`link-muted`,size:`xs`,className:`h-auto min-h-6 min-w-0 shrink justify-start overflow-hidden p-0 font-normal`,"aria-label":n.path,onClick:()=>rt(it(u)),"data-testid":`worktree-row-open`,children:(0,G.jsx)(`span`,{dir:`auto`,className:`min-w-0 ${d}`,children:i})})})}),(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:n.path})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(c,{children:[(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(`span`,{dir:`auto`,tabIndex:0,className:`min-w-0 rounded-xs focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 ${d}`,children:i})}),(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:n.path})]}),i!==n.path&&(0,G.jsx)(`span`,{className:`sr-only`,children:n.path})]}),t[17]=n.path,t[18]=i,t[19]=u,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==v||t[23]!==y?(b=(0,G.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[22]=v,t[23]=y,t[24]=b):b=t[24],b}function Wt(e){let t=(0,U.c)(15),{rows:n,dimmed:i}=e,[a,o]=(0,W.useState)(!1),s=n.length>6,c;t[0]!==n||t[1]!==a?(c=a?n:n.slice(0,6),t[0]=n,t[1]=a,t[2]=c):c=t[2];let l=c,u=n.length-6,d;if(t[3]!==i||t[4]!==l){let e;t[6]===i?e=t[7]:(e=e=>{let{entry:t,label:n}=e;return(0,G.jsx)(Ut,{entry:t,dimmed:i,label:n},`${t.code}:${t.path}`)},t[6]=i,t[7]=e),d=l.map(e),t[3]=i,t[4]=l,t[5]=d}else d=t[5];let f;t[8]!==s||t[9]!==u||t[10]!==a?(f=s&&(0,G.jsx)(`li`,{children:(0,G.jsx)(_,{variant:`link-muted`,size:`xs`,"aria-expanded":a,className:`h-auto min-h-6 justify-start p-0 text-2xs font-normal`,onClick:()=>o(Gt),"data-testid":`worktree-rows-show-all`,children:a?(0,G.jsx)(r,{id:`H86f9p`}):(0,G.jsx)(r,{id:`B6Lac2`,values:{overflowCount:u}})})}),t[8]=s,t[9]=u,t[10]=a,t[11]=f):f=t[11];let p;return t[12]!==d||t[13]!==f?(p=(0,G.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14],p}function Gt(e){return!e}function Kt(e){let t=(0,U.c)(25),{group:n,prefix:i,dimmed:a}=e,f=n.rows.length,[p,m]=(0,W.useState)(!1),h=i===``?n.dir:`${i}/${n.dir}`,g=`size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none ${p?`rotate-90`:``}`,v;t[0]===g?v=t[1]:(v=(0,G.jsx)(O,{className:g,"aria-hidden":!0}),t[0]=g,t[1]=v);let y;t[2]===n.dir?y=t[3]:(y=(0,G.jsx)(`span`,{dir:`auto`,className:`min-w-0 truncate text-start font-mono text-2xs text-muted-foreground`,children:n.dir}),t[2]=n.dir,t[3]=y);let b;t[4]===f?b=t[5]:(b=(0,G.jsx)(`span`,{"aria-hidden":!0,className:`ms-auto shrink-0 ps-1 text-2xs text-muted-foreground tabular-nums`,children:f}),t[4]=f,t[5]=b);let x;t[6]===f?x=t[7]:(x=(0,G.jsx)(`span`,{className:`sr-only`,children:(0,G.jsx)(r,{id:`u3BOHd`,values:{fileCount:f}})}),t[6]=f,t[7]=x);let S;t[8]!==v||t[9]!==y||t[10]!==b||t[11]!==x?(S=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(u,{asChild:!0,children:(0,G.jsxs)(_,{variant:`ghost`,size:`xs`,className:`h-auto min-h-6 w-full justify-start gap-1 px-0 font-normal`,children:[v,y,b,x]})})}),t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S):S=t[12];let C;t[13]===h?C=t[14]:(C=(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:h}),t[13]=h,t[14]=C);let w;t[15]!==S||t[16]!==C?(w=(0,G.jsxs)(c,{children:[S,C]}),t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==a||t[19]!==n.rows?(T=(0,G.jsx)(l,{className:`ps-4`,children:(0,G.jsx)(Wt,{rows:n.rows,dimmed:a})}),t[18]=a,t[19]=n.rows,t[20]=T):T=t[20];let E;return t[21]!==p||t[22]!==w||t[23]!==T?(E=(0,G.jsxs)(d,{open:p,onOpenChange:m,className:`flex flex-col gap-1`,children:[w,T]}),t[21]=p,t[22]=w,t[23]=T,t[24]=E):E=t[24],E}function qt(e){let t=(0,U.c)(39),{title:n,note:i,entries:a,dimmed:o}=e,s=o===void 0?!1:o;if(a.length===0)return null;let c=a.length,f,p,m,h,g,v,y,b,x;if(t[0]!==s||t[1]!==a||t[2]!==c||t[3]!==i||t[4]!==n){let{prefix:e,groups:o,loose:S}=tt(a);m=S,p=d,b=`flex flex-col gap-1`;let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,G.jsx)(O,{className:`size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-90`,"aria-hidden":!0}),t[14]=C):C=t[14];let w;t[15]===n?w=t[16]:(w=(0,G.jsx)(`span`,{className:`text-2xs font-medium text-muted-foreground`,children:n}),t[15]=n,t[16]=w);let T;t[17]===c?T=t[18]:(T=(0,G.jsx)(`span`,{className:`ms-auto shrink-0 ps-1 text-2xs text-muted-foreground tabular-nums`,children:(0,G.jsx)(r,{id:`u3BOHd`,values:{fileCount:c}})}),t[17]=c,t[18]=T),t[19]!==w||t[20]!==T?(x=(0,G.jsx)(u,{asChild:!0,children:(0,G.jsxs)(_,{variant:`ghost`,size:`xs`,className:`group h-auto min-h-6 w-full justify-start gap-1 px-0 font-normal data-[state=open]:bg-transparent`,children:[C,w,T]})}),t[19]=w,t[20]=T,t[21]=x):x=t[21],f=l,h=`flex flex-col gap-1 ps-3`,t[22]===i?g=t[23]:(g=i&&(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground/80`,children:i}),t[22]=i,t[23]=g),v=e!==``&&(0,G.jsxs)(`span`,{dir:`auto`,className:`break-all font-mono text-2xs text-muted-foreground`,children:[e,`/`]}),y=o.map(t=>(0,G.jsx)(Kt,{group:t,prefix:e,dimmed:s},e===``?t.dir:`${e}/${t.dir}`)),t[0]=s,t[1]=a,t[2]=c,t[3]=i,t[4]=n,t[5]=f,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=v,t[11]=y,t[12]=b,t[13]=x}else f=t[5],p=t[6],m=t[7],h=t[8],g=t[9],v=t[10],y=t[11],b=t[12],x=t[13];let S;t[24]!==s||t[25]!==m?(S=m.length>0&&(0,G.jsx)(Wt,{rows:m,dimmed:s}),t[24]=s,t[25]=m,t[26]=S):S=t[26];let C;t[27]!==f||t[28]!==h||t[29]!==g||t[30]!==v||t[31]!==y||t[32]!==S?(C=(0,G.jsxs)(f,{className:h,children:[g,v,y,S]}),t[27]=f,t[28]=h,t[29]=g,t[30]=v,t[31]=y,t[32]=S,t[33]=C):C=t[33];let w;return t[34]!==p||t[35]!==b||t[36]!==x||t[37]!==C?(w=(0,G.jsxs)(p,{className:b,children:[x,C]}),t[34]=p,t[35]=b,t[36]=x,t[37]=C,t[38]=w):w=t[38],w}function Jt(e){let t=(0,U.c)(9),{direction:n,count:r}=e,{_:a}=i();if(r<=0)return null;let o;t[0]===n?o=t[1]:(o=n===`behind`?(0,G.jsx)(E,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,G.jsx)(D,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]!==a||t[3]!==r||t[4]!==n?(s=a(n===`behind`?{id:`sKHiNR`,values:{count:r}}:{id:`9ZxzfT`,values:{count:r}}),t[2]=a,t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,G.jsxs)(`span`,{className:`flex flex-1 items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs text-foreground`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Yt(e){let t=new Set,n=[],r=[];for(let i of[...e.staged,...e.notStaged,...e.untracked])t.has(i.path)||(t.add(i.path),(i.syncScoped?n:r).push(i));return{willPush:n,wontPush:r}}function Xt(e){let t=(0,U.c)(6),{lastReadAt:n}=e,{_:a}=i(),o=ot(),s;t[0]!==a||t[1]!==n||t[2]!==o?(s=X(a,n,o),t[0]=a,t[1]=n,t[2]=o,t[3]=s):s=t[3];let c=s,l;return t[4]===c?l=t[5]:(l=(0,G.jsx)(`p`,{className:`text-2xs text-muted-foreground`,"data-testid":`worktree-stale`,children:(0,G.jsx)(r,{id:`e-pP6g`,values:{staleRelative:c}})}),t[4]=c,t[5]=l),l}function Zt(e){let t=(0,U.c)(36),{status:n,worktree:a,loading:o,unreadable:s,stale:c,lastReadAt:l}=e,u;t[0]===a?u=t[1]:(u=a?Yt(a):{willPush:[],wontPush:[]},t[0]=a,t[1]=u);let{willPush:d,wontPush:f}=u,p;t[2]===a?.incoming?p=t[3]:(p=a?.incoming??[],t[2]=a?.incoming,t[3]=p);let m=p,{_:h}=i(),g=c&&!s&&a!==null&&l!==null,_=a!==null&&d.length===0&&f.length===0&&m.length===0,v;t[4]!==h||t[5]!==g||t[6]!==s?(v=s?h({id:`L9ox9k`}):g?h({id:`_LK4d6`}):``,t[4]=h,t[5]=g,t[6]=s,t[7]=v):v=t[7];let y=v,b;t[8]===y?b=t[9]:(b=(0,G.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"data-testid":`worktree-announcer`,children:y}),t[8]=y,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,G.jsx)(Bt,{id:`worktree-status-label`,children:(0,G.jsx)(r,{id:`uAQUqI`})}),t[10]=x):x=t[10];let S;t[11]!==s||t[12]!==a?(S=!s&&a&&(a.branch||a.detached)&&(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-2xs text-muted-foreground`,"data-testid":`worktree-branch`,children:a.detached?(0,G.jsx)(r,{id:`OBdkpo`}):a.upstream?`${a.branch} → ${a.upstream}`:a.branch}),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[x,S]}),t[14]=S,t[15]=C);let w;t[16]!==n.ahead||t[17]!==n.behind?(w=(n.behind>0||n.ahead>0)&&(0,G.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,G.jsx)(Jt,{direction:`behind`,count:n.behind}),(0,G.jsx)(Jt,{direction:`ahead`,count:n.ahead})]}),t[16]=n.ahead,t[17]=n.behind,t[18]=w):w=t[18];let T;t[19]!==_||t[20]!==m||t[21]!==o||t[22]!==s||t[23]!==d||t[24]!==f||t[25]!==a?(T=s?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`worktree-unreadable`,children:(0,G.jsx)(r,{id:`L9ox9k`})}):o?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`eolhcI`})}):_?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`WfcERq`})}):a&&(0,G.jsxs)(`section`,{className:`flex max-h-56 flex-col gap-2.5 overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,tabIndex:0,"aria-labelledby":`worktree-status-label`,"data-testid":`worktree-listing`,children:[(0,G.jsx)(qt,{title:(0,G.jsx)(r,{id:`NcwbBM`}),entries:m}),(0,G.jsx)(qt,{title:(0,G.jsx)(r,{id:`JOhCT9`}),entries:d}),(0,G.jsx)(qt,{title:(0,G.jsx)(r,{id:`vsFXfP`}),note:(0,G.jsx)(r,{id:`PxZCNM`}),entries:f,dimmed:!0}),a.truncated&&(0,G.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`KvwJv8`})})]}),t[19]=_,t[20]=m,t[21]=o,t[22]=s,t[23]=d,t[24]=f,t[25]=a,t[26]=T):T=t[26];let E;t[27]!==l||t[28]!==g?(E=g&&l!==null&&(0,G.jsx)(Xt,{lastReadAt:l}),t[27]=l,t[28]=g,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==b||t[32]!==C||t[33]!==w||t[34]!==T?(D=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t pt-3`,children:[b,C,w,T,E]}),t[30]=E,t[31]=b,t[32]=C,t[33]=w,t[34]=T,t[35]=D):D=t[35],D}function Qt(e){let t=(0,U.c)(19),{pulledAt:n,pushedAt:r,combinedAt:a}=e,{_:o}=i(),s,c,l;if(t[0]!==o||t[1]!==a||t[2]!==n||t[3]!==r){s=n===null?null:Z(o,n),c=r===null?null:Z(o,r);let e=a===null?null:Z(o,a);l=s!==null&&c!==null?o({id:`1TA-aJ`,values:{pulled:s,pushed:c}}):s===null?c===null?e===null?null:o({id:`irnKr_`,values:{updatedRelative:e}}):o({id:`lPkjpD`,values:{pushed:c}}):o({id:`xW5AUw`,values:{pulled:s}}),t[0]=o,t[1]=a,t[2]=n,t[3]=r,t[4]=s,t[5]=c,t[6]=l}else s=t[4],c=t[5],l=t[6];let u=l,d=s!==null||c!==null;if(u===null){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(`span`,{}),t[7]=e):e=t[7],e}let f;t[8]!==u||t[9]!==d?(f=d&&(0,G.jsx)(`span`,{className:`sr-only`,"data-testid":`sync-popover-last-sync-label`,children:u}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==u||t[12]!==s||t[13]!==c||t[14]!==d?(p=d?(0,G.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex items-center gap-1`,children:[s!==null&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(E,{className:`size-3`}),s]}),s!==null&&c!==null&&(0,G.jsx)(`span`,{children:`·`}),c!==null&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(D,{className:`size-3`}),c]})]}):(0,G.jsx)(`span`,{"aria-hidden":`true`,children:u}),t[11]=u,t[12]=s,t[13]=c,t[14]=d,t[15]=p):p=t[15];let m;return t[16]!==f||t[17]!==p?(m=(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-last-sync`,children:[f,p]}),t[16]=f,t[17]=p,t[18]=m):m=t[18],m}function $t(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:en,"data-testid":`sync-popover-add-host-token`,children:(0,G.jsx)(r,{id:`zXZJoN`})})}),e[0]=t):t=e[0],t}function en(){return R()}function tn(e){let t=(0,U.c)(152),{status:n,onSignIn:a,onSetIdentity:o}=e,{_:s}=i(),{conflictCount:c}=n,{projectLocalConfig:l,projectLocalSynced:u}=w(),d=l?.autoSync,{mode:v,confirmOpen:y,setConfirmOpen:b,pendingMode:x,strandedCommitCount:C,onModeSelect:T,onConfirm:O}=Ne(d,n.ahead),{status:k,loading:A,unreadable:N,stale:P,lastReadAt:F}=He(!0),I=v===`follow`,ne;t[0]===n?ne=t[1]:(ne=lt(n),t[0]=n,t[1]=ne);let L=ne,re;t[2]===n?re=t[3]:(re=Et(n),t[2]=n,t[3]=re);let ie=re,ae=n.lastPullOkUtc??null,oe=n.lastPushOkUtc??null,se=n.lastRunUtc??n.lastSyncUtc??null,R=n.pushPermission?.checkStatus===`denied`&&n.pushPermission.deniedReason!==`not-authenticated`&&!ie,ce;t[4]===n.remote?ce=t[5]:(ce=kt(n.remote),t[4]=n.remote,t[5]=ce);let le=ce,ue=!R,z=L===`fetching`||L===`pulling`||L===`pushing`,[fe,me]=(0,W.useState)(null),he,B;t[6]===z?(he=t[7],B=t[8]):(he=()=>{z||me(null)},B=[z],t[6]=z,t[7]=he,t[8]=B),(0,W.useEffect)(he,B);let _e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{me(t=>t===e?null:t)},t[9]=_e):_e=t[9];let ve=_e,V=z?fe??(L===`pushing`?`push`:`pull`):null,ye;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ye=e=>{me(e),nt(e,()=>ve(e))},t[10]=ye):ye=t[10];let be=ye,xe=L===`dormant`||L===`auth-error`||n.state===`conflict`,H=xe||n.conflictCount>0,Se;t[11]===n.blockingPaths?Se=t[12]:(Se=n.blockingPaths??[],t[11]=n.blockingPaths,t[12]=Se);let Ce=Se,{conflicts:we}=ge(),Ee;t[13]===we?Ee=t[14]:(Ee=we.find(sn)?.docName??null,t[13]=we,t[14]=Ee);let De=Ee,Oe;t[15]===n?Oe=t[16]:(Oe=(0,G.jsx)(ut,{status:n}),t[15]=n,t[16]=Oe);let ke;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,G.jsx)(`span`,{className:`text-1sm font-medium`,children:(0,G.jsx)(r,{id:`yZepkk`})}),t[17]=ke):ke=t[17];let Ae;t[18]===Oe?Ae=t[19]:(Ae=(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[Oe,ke]}),t[18]=Oe,t[19]=Ae);let je;t[20]!==s||t[21]!==n.remote?(je=n.remote&&(n.remote.webUrl?(0,G.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-xs text-foreground hover:text-primary hover:underline`,"aria-label":s({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,G.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,G.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs text-foreground`,children:n.remote.label})),t[20]=s,t[21]=n.remote,t[22]=je):je=t[22];let Me;t[23]!==Ae||t[24]!==je?(Me=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[Ae,je]}),t[23]=Ae,t[24]=je,t[25]=Me):Me=t[25];let Pe=x??`full`,Fe;t[26]!==y||t[27]!==O||t[28]!==b||t[29]!==C||t[30]!==Pe?(Fe=(0,G.jsx)(qe,{open:y,onOpenChange:b,onConfirm:O,variant:Pe,strandedCommitCount:C}),t[26]=y,t[27]=O,t[28]=b,t[29]=C,t[30]=Pe,t[31]=Fe):Fe=t[31];let Ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,G.jsx)(Bt,{children:(0,G.jsx)(r,{id:`CnOGgs`})}),t[32]=Ie):Ie=t[32];let Le;t[33]===T?Le=t[34]:(Le=e=>{S(e)&&T(e)},t[33]=T,t[34]=Le);let Re=!u,ze;t[35]===s?ze=t[36]:(ze=s({id:`CnOGgs`}),t[35]=s,t[36]=ze);let Be;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,G.jsx)(h,{}),t[37]=Be):Be=t[37];let Ve;t[38]===ze?Ve=t[39]:(Ve=(0,G.jsx)(m,{size:`sm`,className:`w-full text-xs`,"aria-label":ze,"data-testid":`sync-mode-select`,children:Be}),t[38]=ze,t[39]=Ve);let Ue;t[40]===s?Ue=t[41]:(Ue=s({id:`BWTzAb`}),t[40]=s,t[41]=Ue);let We;t[42]===Ue?We=t[43]:(We=(0,G.jsx)(f,{value:`off`,className:`text-xs`,children:Ue}),t[42]=Ue,t[43]=We);let K;t[44]===s?K=t[45]:(K=s({id:`tlGXxX`}),t[44]=s,t[45]=K);let q;t[46]===K?q=t[47]:(q=(0,G.jsx)(f,{value:`follow`,className:`text-xs`,children:K}),t[46]=K,t[47]=q);let Ge;t[48]===s?Ge=t[49]:(Ge=s({id:`IXiG0B`}),t[48]=s,t[49]=Ge);let Ke;t[50]!==R||t[51]!==Ge?(Ke=(0,G.jsx)(f,{value:`full`,className:`text-xs`,disabled:R,children:Ge}),t[50]=R,t[51]=Ge,t[52]=Ke):Ke=t[52];let Je;t[53]!==We||t[54]!==q||t[55]!==Ke?(Je=(0,G.jsxs)(p,{children:[We,q,Ke]}),t[53]=We,t[54]=q,t[55]=Ke,t[56]=Je):Je=t[56];let Ye;t[57]!==v||t[58]!==Le||t[59]!==Re||t[60]!==Ve||t[61]!==Je?(Ye=(0,G.jsxs)(g,{value:v,onValueChange:Le,disabled:Re,children:[Ve,Je]}),t[57]=v,t[58]=Le,t[59]=Re,t[60]=Ve,t[61]=Je,t[62]=Ye):Ye=t[62];let Ze;t[63]===v?Ze=t[64]:(Ze=(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:v===`off`?(0,G.jsx)(r,{id:`qD3krc`}):v===`follow`?(0,G.jsx)(r,{id:`PGRnbw`}):(0,G.jsx)(r,{id:`zBiFZh`})}),t[63]=v,t[64]=Ze);let Qe;t[65]!==Ye||t[66]!==Ze?(Qe=(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Ie,Ye,Ze]}),t[65]=Ye,t[66]=Ze,t[67]=Qe):Qe=t[67];let J;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,G.jsx)(Bt,{children:(0,G.jsx)(r,{id:`BWTzAb`})}),t[68]=J):J=t[68];let $e=z||xe,et;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>be(`pull`),t[69]=et):et=t[69];let Y;t[70]===V?Y=t[71]:(Y=V===`pull`?(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,G.jsx)(E,{"data-icon":`inline-start`}),t[70]=V,t[71]=Y);let tt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,G.jsx)(r,{id:`e4GHWP`}),t[72]=tt):tt=t[72];let it;t[73]!==$e||t[74]!==Y?(it=(0,G.jsxs)(_,{variant:`outline`,size:`xs`,className:`flex-1`,disabled:$e,onClick:et,"data-testid":`sync-popover-pull`,children:[Y,tt]}),t[73]=$e,t[74]=Y,t[75]=it):it=t[75];let at;t[76]!==z||t[77]!==ue||t[78]!==H||t[79]!==V?(at=ue&&(0,G.jsxs)(_,{variant:`outline`,size:`xs`,className:`flex-1`,disabled:z||H,onClick:()=>be(`push`),"data-testid":`sync-popover-push`,children:[V===`push`?(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,G.jsx)(D,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`uO9WLl`})]}),t[76]=z,t[77]=ue,t[78]=H,t[79]=V,t[80]=at):at=t[80];let X;t[81]!==it||t[82]!==at?(X=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[it,at]}),t[81]=it,t[82]=at,t[83]=X):X=t[83];let Z;t[84]!==z||t[85]!==ue||t[86]!==H||t[87]!==V?(Z=ue&&(0,G.jsxs)(_,{size:`xs`,className:`w-full`,disabled:z||H,onClick:()=>be(`sync`),"data-testid":`sync-popover-sync`,children:[V===`sync`?(0,G.jsx)(j,{"aria-hidden":`true`,icon:M,"data-icon":`inline-start`}):(0,G.jsx)(M,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`YEzhIr`})]}),t[84]=z,t[85]=ue,t[86]=H,t[87]=V,t[88]=Z):Z=t[88];let ot;t[89]!==X||t[90]!==Z?(ot=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t pt-3`,children:[J,X,Z]}),t[89]=X,t[90]=Z,t[91]=ot):ot=t[91];let st;if(t[92]!==s||t[93]!==n){let e;t[95]===s?e=t[96]:(e=e=>(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:e.direction===`push`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[s({id:`uO9WLl`}),`: `]}),e.message]}):e.direction===`pull`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[s({id:`e4GHWP`}),`: `]}),e.message]}):e.message},e.key),t[95]=s,t[96]=e),st=It(n).map(e),t[92]=s,t[93]=n,t[94]=st}else st=t[94];let Q;t[97]===n?Q=t[98]:(Q=Dt(n)&&n.pushPermission?.checkStatus===`denied`?wt(n.pushPermission).map(on):null,t[97]=n,t[98]=Q);let ct;t[99]!==n.pausedReason||t[100]!==n.pushPermission?(ct=n.pausedReason===`no-push-permission`&&n.pushPermission?.checkStatus===`denied`?wt(n.pushPermission).map(an):null,t[99]=n.pausedReason,t[100]=n.pushPermission,t[101]=ct):ct=t[101];let $;t[102]!==st||t[103]!==Q||t[104]!==ct?($=(0,G.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-col gap-3.5 empty:sr-only`,"data-testid":`sync-popover-status`,children:[st,Q,ct]}),t[102]=st,t[103]=Q,t[104]=ct,t[105]=$):$=t[105];let dt;t[106]!==Ce||t[107]!==I||t[108]!==R||t[109]!==a||t[110]!==n?(dt=!I&&Ot(n.pushPermission)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`ycIX5i`})}),a&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):Ce.length>0?(0,G.jsx)(Xe,{paths:Ce}):Dt(n)?null:n.pausedReason?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(St,{reason:n.pausedReason})}),(0,G.jsx)(bt,{paths:n.refusedSymlinkPaths})]}):!I&&R&&n.pushPermission?.checkStatus===`denied`?Ct(n.pushPermission.deniedReason,n.pushPermission).map(rn):Lt(n.pushPermission)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`C_cPoW`})}),a&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):null,t[106]=Ce,t[107]=I,t[108]=R,t[109]=a,t[110]=n,t[111]=dt):dt=t[111];let ft;t[112]!==De||t[113]!==L?(ft=L===`conflict`&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-amber-700 dark:text-amber-400`,children:(0,G.jsx)(r,{id:`ko386X`})}),De!==null&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>rt(de(De)),children:(0,G.jsx)(r,{id:`5k0NLb`})})]}),t[112]=De,t[113]=L,t[114]=ft):ft=t[114];let pt;t[115]!==le||t[116]!==a||t[117]!==L||t[118]!==n?(pt=L===`auth-error`&&!Dt(n)&&(le?a&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-destructive`,children:(0,G.jsx)(r,{id:`Vl1H8I`})}),(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):jt(n.remote)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-destructive`,"data-testid":`sync-popover-auth-error-unverified`,children:(0,G.jsx)(r,{id:`FioJgb`})}),(0,G.jsx)($t,{})]}):(0,G.jsx)(`p`,{className:`text-xs text-destructive`,"data-testid":`sync-popover-auth-error-no-token`,children:(0,G.jsx)(r,{id:`w-Wt3H`})})),t[115]=le,t[116]=a,t[117]=L,t[118]=n,t[119]=pt):pt=t[119];let mt;t[120]===c?mt=t[121]:(mt=c>0&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`B4_ipX`,values:{conflictCount:c}})}),t[120]=c,t[121]=mt);let ht;t[122]!==n||t[123]!==k||t[124]!==F||t[125]!==A||t[126]!==P||t[127]!==N?(ht=(0,G.jsx)(Zt,{status:n,worktree:k,loading:A,unreadable:N,stale:P,lastReadAt:F}),t[122]=n,t[123]=k,t[124]=F,t[125]=A,t[126]=P,t[127]=N,t[128]=ht):ht=t[128];let gt;t[129]!==se||t[130]!==ae||t[131]!==oe?(gt=(0,G.jsx)(Qt,{pulledAt:ae,pushedAt:oe,combinedAt:se}),t[129]=se,t[130]=ae,t[131]=oe,t[132]=gt):gt=t[132];let _t;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsxs)(_,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs text-muted-foreground hover:font-medium hover:text-foreground hover:no-underline`,onClick:nn,"data-testid":`sync-popover-settings`,children:[(0,G.jsx)(te,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`VNgKZz`})]})}),t[133]=_t):_t=t[133];let vt;t[134]===gt?vt=t[135]:(vt=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[gt,_t]}),t[134]=gt,t[135]=vt);let yt;t[136]!==o||t[137]!==n.identityUnresolved?(yt=n.identityUnresolved&&o&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,G.jsx)(Te,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:(0,G.jsx)(r,{id:`nrGWJ7`})}),(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:o,children:(0,G.jsx)(r,{id:`keNFEd`})})]})]}),t[136]=o,t[137]=n.identityUnresolved,t[138]=yt):yt=t[138];let xt;return t[139]!==Me||t[140]!==Fe||t[141]!==Qe||t[142]!==ot||t[143]!==$||t[144]!==dt||t[145]!==ft||t[146]!==pt||t[147]!==mt||t[148]!==ht||t[149]!==vt||t[150]!==yt?(xt=(0,G.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[Me,Fe,Qe,ot,$,dt,ft,pt,mt,ht,vt,yt]}),t[139]=Me,t[140]=Fe,t[141]=Qe,t[142]=ot,t[143]=$,t[144]=dt,t[145]=ft,t[146]=pt,t[147]=mt,t[148]=ht,t[149]=vt,t[150]=yt,t[151]=xt):xt=t[151],xt}function nn(){return ce({advanced:!0})}function rn(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function an(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function on(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function sn(e){return e.docName!==null}function cn(e){let t=(0,U.c)(68),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:a,onSetIdentity:l}=n,{_:u}=i(),{status:d,fetchError:f}=he();if(!d){if(f){let e;t[2]===u?e=t[3]:(e=u({id:`iqIDv4`}),t[2]=u,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(xe,{className:`size-3.5`}),t[4]=n):n=t[4];let i;t[5]===e?i=t[6]:(i=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=i);let a;t[7]===f?a=t[8]:(a=(0,G.jsx)(s,{children:f===`network`?(0,G.jsx)(r,{id:`I5AfhE`}):(0,G.jsx)(r,{id:`uKRYiW`})}),t[7]=f,t[8]=a);let l;return t[9]!==i||t[10]!==a?(l=(0,G.jsxs)(c,{children:[i,a]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}return null}if(!d.hasRemote)return null;let p;t[12]===d?p=t[13]:(p=dt(d),t[12]=d,t[13]=p);let m=p,h,g,v,y,b,x,S,C,w,T,E,D;if(t[14]!==u||t[15]!==d){let e=Rt(d);x=!!d.identityUnresolved,b=me,y=c,v=o,D=!0,g=z,E=!0,h=_,S=`ghost`,C=`icon-sm`,w=`text-muted-foreground relative`,T=u(x?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=u,t[15]=d,t[16]=h,t[17]=g,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D}else h=t[16],g=t[17],v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27];let ee;t[28]===d?ee=t[29]:(ee=(0,G.jsx)(ut,{status:d}),t[28]=d,t[29]=ee);let O;t[30]===m?O=t[31]:(O=m&&(0,G.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:m}),t[30]=m,t[31]=O);let k;t[32]!==m||t[33]!==x?(k=!m&&x&&(0,G.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[32]=m,t[33]=x,t[34]=k):k=t[34];let te;t[35]!==h||t[36]!==O||t[37]!==k||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==T||t[42]!==ee?(te=(0,G.jsxs)(h,{variant:S,size:C,className:w,"aria-label":T,children:[ee,O,k]}),t[35]=h,t[36]=O,t[37]=k,t[38]=S,t[39]=C,t[40]=w,t[41]=T,t[42]=ee,t[43]=te):te=t[43];let A;t[44]!==g||t[45]!==te||t[46]!==E?(A=(0,G.jsx)(g,{asChild:E,children:te}),t[44]=g,t[45]=te,t[46]=E,t[47]=A):A=t[47];let j;t[48]!==v||t[49]!==A||t[50]!==D?(j=(0,G.jsx)(v,{asChild:D,children:A}),t[48]=v,t[49]=A,t[50]=D,t[51]=j):j=t[51];let M;t[52]===d?M=t[53]:(M=zt(d),t[52]=d,t[53]=M);let N;t[54]===M?N=t[55]:(N=(0,G.jsx)(s,{children:M}),t[54]=M,t[55]=N);let P;t[56]!==y||t[57]!==j||t[58]!==N?(P=(0,G.jsxs)(y,{children:[j,N]}),t[56]=y,t[57]=j,t[58]=N,t[59]=P):P=t[59];let F;t[60]!==l||t[61]!==a||t[62]!==d?(F=(0,G.jsx)(fe,{align:`end`,className:`flex max-h-(--radix-popover-content-available-height) w-80 flex-col overflow-y-auto p-3`,children:(0,G.jsx)(tn,{status:d,onSignIn:a,onSetIdentity:l})}),t[60]=l,t[61]=a,t[62]=d,t[63]=F):F=t[63];let I;return t[64]!==b||t[65]!==P||t[66]!==F?(I=(0,G.jsxs)(b,{children:[P,F]}),t[64]=b,t[65]=P,t[66]=F,t[67]=I):I=t[67],I}export{je as C,V as E,ke as S,H as T,q as _,wt as a,Oe as b,Et as c,$ as d,jt as f,K as g,qe as h,lt as i,kt as l,Lt as m,bt as n,Ft as o,Ot as p,cn as r,At as s,St as t,Dt as u,Pe as v,De as w,Ee as x,Ae as y};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./switch-BKZTXkzu.js";import{n as o}from"./dist-BGzUo_18.js";import{n as s}from"./config-errors-DCSQBhyj.js";import{i as c}from"./use-apply-config-theme-CYFG76sS.js";import"./config-provider-Cs3B2_OX.js";import{n as l,t as ee}from"./use-terminal-enabled-Vqy8aWBy.js";import{n as u,t as d}from"./SettingsSectionHeader-XnGFBVeB.js";var f=i(),p=e(n(),1),m=t();function h(){let e=(0,f.c)(70),{_:t}=r(),{enabled:n,synced:i}=ee(),h=l(),_=n!==!1,{userConfig:v,userBinding:y,userSynced:b}=c(),x=v?.agents?.autoApproveOkTools!==!1,[S,te]=(0,p.useState)(!1),C,w;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.terminal.cliPreflight(`codex`).then(e=>{t||te(e.onPath===`present`&&e.okServerConfigured!==!0)}).catch(g),()=>{t=!0}},w=[],e[0]=C,e[1]=w):(C=e[0],w=e[1]),(0,p.useEffect)(C,w);let T;e[2]!==t||e[3]!==h?(T=function(e){if(h===null){o.error(t({id:`w6sBjd`}));return}let n=h(e);n.ok||o.error(t(e?{id:`jKd3AP`,values:{0:n.error}}:{id:`pajIrl`,values:{0:n.error}}))},e[2]=t,e[3]=h,e[4]=T):T=e[4];let E=T,D;e[5]!==t||e[6]!==y?(D=function(e){if(y===null){o.error(t({id:`fnlBN4`}));return}let n=y.patch({agents:{autoApproveOkTools:e}});if(!n.ok){let e=s(n.error);o.error(t({id:`habOU_`,values:{detail:e}}))}},e[5]=t,e[6]=y,e[7]=D):D=e[7];let O=D,k;e[8]===t?k=e[9]:(k=t({id:`ALhMYW`}),e[8]=t,e[9]=k);let A;e[10]===t?A=e[11]:(A=t({id:`FCAcjR`}),e[10]=t,e[11]=A);let j;e[12]!==k||e[13]!==A?(j=(0,m.jsx)(d,{titleId:`settings-terminal-title`,title:k,scope:`project-local`,level:`block`,children:A}),e[12]=k,e[13]=A,e[14]=j):j=e[14];let M;e[15]===t?M=e[16]:(M=t({id:`E4XYYH`}),e[15]=t,e[16]=M);let N;e[17]===M?N=e[18]:(N=(0,m.jsx)(`label`,{htmlFor:`settings-terminal-toggle`,className:`text-sm font-medium`,children:M}),e[17]=M,e[18]=N);let P;e[19]!==t||e[20]!==_?(P=t(_?{id:`6ASTuj`}:{id:`QpSqAP`}),e[19]=t,e[20]=_,e[21]=P):P=e[21];let F;e[22]===P?F=e[23]:(F=(0,m.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-body`,children:P}),e[22]=P,e[23]=F);let I;e[24]!==F||e[25]!==N?(I=(0,m.jsxs)(`div`,{className:`space-y-0.5`,children:[N,F]}),e[24]=F,e[25]=N,e[26]=I):I=e[26];let L=!i||h===null,R;e[27]===t?R=e[28]:(R=t({id:`E4XYYH`}),e[27]=t,e[28]=R);let z;e[29]!==E||e[30]!==_||e[31]!==L||e[32]!==R?(z=(0,m.jsx)(a,{id:`settings-terminal-toggle`,checked:_,onCheckedChange:E,disabled:L,"aria-label":R,"data-testid":`settings-terminal-toggle`}),e[29]=E,e[30]=_,e[31]=L,e[32]=R,e[33]=z):z=e[33];let B;e[34]!==I||e[35]!==z?(B=(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[I,z]}),e[34]=I,e[35]=z,e[36]=B):B=e[36];let V;e[37]===t?V=e[38]:(V=t({id:`ilodsp`}),e[37]=t,e[38]=V);let H;e[39]===V?H=e[40]:(H=(0,m.jsx)(`label`,{htmlFor:`settings-terminal-autoapprove-toggle`,className:`text-sm font-medium`,children:V}),e[39]=V,e[40]=H);let U;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,m.jsx)(u,{scope:`user`}),e[41]=U):U=e[41];let W;e[42]===H?W=e[43]:(W=(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[H,U]}),e[42]=H,e[43]=W);let G;e[44]===t?G=e[45]:(G=t({id:`cPgQ_i`}),e[44]=t,e[45]=G);let K;e[46]===G?K=e[47]:(K=(0,m.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-body`,children:G}),e[46]=G,e[47]=K);let q;e[48]!==t||e[49]!==x||e[50]!==S?(q=x&&S?(0,m.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-codex-note`,children:t({id:`Kr3VPS`})}):null,e[48]=t,e[49]=x,e[50]=S,e[51]=q):q=e[51];let J;e[52]!==W||e[53]!==K||e[54]!==q?(J=(0,m.jsxs)(`div`,{className:`space-y-0.5`,children:[W,K,q]}),e[52]=W,e[53]=K,e[54]=q,e[55]=J):J=e[55];let Y=!b||y===null,X;e[56]===t?X=e[57]:(X=t({id:`ilodsp`}),e[56]=t,e[57]=X);let Z;e[58]!==O||e[59]!==x||e[60]!==Y||e[61]!==X?(Z=(0,m.jsx)(a,{id:`settings-terminal-autoapprove-toggle`,checked:x,onCheckedChange:O,disabled:Y,"aria-label":X,"data-testid":`settings-terminal-autoapprove-toggle`}),e[58]=O,e[59]=x,e[60]=Y,e[61]=X,e[62]=Z):Z=e[62];let Q;e[63]!==J||e[64]!==Z?(Q=(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[J,Z]}),e[63]=J,e[64]=Z,e[65]=Q):Q=e[65];let $;return e[66]!==B||e[67]!==Q||e[68]!==j?($=(0,m.jsxs)(`section`,{"aria-labelledby":`settings-terminal-title`,className:`space-y-3`,"data-field":`section:terminal`,"data-testid":`settings-terminal`,children:[j,B,Q]}),e[66]=B,e[67]=Q,e[68]=j,e[69]=$):$=e[69],$}function g(){}export{h as TerminalSection};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./switch-BKZTXkzu.js";import{n as o}from"./dist-BGzUo_18.js";import{n as s}from"./config-errors-DCSQBhyj.js";import{i as c}from"./use-apply-config-theme-CYFG76sS.js";import"./config-provider-DBgrt1kx.js";import{n as l,t as ee}from"./use-terminal-enabled-CYPFWXCG.js";import{n as u,t as d}from"./SettingsSectionHeader-XnGFBVeB.js";var f=i(),p=e(n(),1),m=t();function h(){let e=(0,f.c)(70),{_:t}=r(),{enabled:n,synced:i}=ee(),h=l(),_=n!==!1,{userConfig:v,userBinding:y,userSynced:b}=c(),x=v?.agents?.autoApproveOkTools!==!1,[S,te]=(0,p.useState)(!1),C,w;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.terminal.cliPreflight(`codex`).then(e=>{t||te(e.onPath===`present`&&e.okServerConfigured!==!0)}).catch(g),()=>{t=!0}},w=[],e[0]=C,e[1]=w):(C=e[0],w=e[1]),(0,p.useEffect)(C,w);let T;e[2]!==t||e[3]!==h?(T=function(e){if(h===null){o.error(t({id:`w6sBjd`}));return}let n=h(e);n.ok||o.error(t(e?{id:`jKd3AP`,values:{0:n.error}}:{id:`pajIrl`,values:{0:n.error}}))},e[2]=t,e[3]=h,e[4]=T):T=e[4];let E=T,D;e[5]!==t||e[6]!==y?(D=function(e){if(y===null){o.error(t({id:`fnlBN4`}));return}let n=y.patch({agents:{autoApproveOkTools:e}});if(!n.ok){let e=s(n.error);o.error(t({id:`habOU_`,values:{detail:e}}))}},e[5]=t,e[6]=y,e[7]=D):D=e[7];let O=D,k;e[8]===t?k=e[9]:(k=t({id:`ALhMYW`}),e[8]=t,e[9]=k);let A;e[10]===t?A=e[11]:(A=t({id:`FCAcjR`}),e[10]=t,e[11]=A);let j;e[12]!==k||e[13]!==A?(j=(0,m.jsx)(d,{titleId:`settings-terminal-title`,title:k,scope:`project-local`,level:`block`,children:A}),e[12]=k,e[13]=A,e[14]=j):j=e[14];let M;e[15]===t?M=e[16]:(M=t({id:`E4XYYH`}),e[15]=t,e[16]=M);let N;e[17]===M?N=e[18]:(N=(0,m.jsx)(`label`,{htmlFor:`settings-terminal-toggle`,className:`text-sm font-medium`,children:M}),e[17]=M,e[18]=N);let P;e[19]!==t||e[20]!==_?(P=t(_?{id:`6ASTuj`}:{id:`QpSqAP`}),e[19]=t,e[20]=_,e[21]=P):P=e[21];let F;e[22]===P?F=e[23]:(F=(0,m.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-body`,children:P}),e[22]=P,e[23]=F);let I;e[24]!==F||e[25]!==N?(I=(0,m.jsxs)(`div`,{className:`space-y-0.5`,children:[N,F]}),e[24]=F,e[25]=N,e[26]=I):I=e[26];let L=!i||h===null,R;e[27]===t?R=e[28]:(R=t({id:`E4XYYH`}),e[27]=t,e[28]=R);let z;e[29]!==E||e[30]!==_||e[31]!==L||e[32]!==R?(z=(0,m.jsx)(a,{id:`settings-terminal-toggle`,checked:_,onCheckedChange:E,disabled:L,"aria-label":R,"data-testid":`settings-terminal-toggle`}),e[29]=E,e[30]=_,e[31]=L,e[32]=R,e[33]=z):z=e[33];let B;e[34]!==I||e[35]!==z?(B=(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[I,z]}),e[34]=I,e[35]=z,e[36]=B):B=e[36];let V;e[37]===t?V=e[38]:(V=t({id:`ilodsp`}),e[37]=t,e[38]=V);let H;e[39]===V?H=e[40]:(H=(0,m.jsx)(`label`,{htmlFor:`settings-terminal-autoapprove-toggle`,className:`text-sm font-medium`,children:V}),e[39]=V,e[40]=H);let U;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,m.jsx)(u,{scope:`user`}),e[41]=U):U=e[41];let W;e[42]===H?W=e[43]:(W=(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[H,U]}),e[42]=H,e[43]=W);let G;e[44]===t?G=e[45]:(G=t({id:`cPgQ_i`}),e[44]=t,e[45]=G);let K;e[46]===G?K=e[47]:(K=(0,m.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-body`,children:G}),e[46]=G,e[47]=K);let q;e[48]!==t||e[49]!==x||e[50]!==S?(q=x&&S?(0,m.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-codex-note`,children:t({id:`Kr3VPS`})}):null,e[48]=t,e[49]=x,e[50]=S,e[51]=q):q=e[51];let J;e[52]!==W||e[53]!==K||e[54]!==q?(J=(0,m.jsxs)(`div`,{className:`space-y-0.5`,children:[W,K,q]}),e[52]=W,e[53]=K,e[54]=q,e[55]=J):J=e[55];let Y=!b||y===null,X;e[56]===t?X=e[57]:(X=t({id:`ilodsp`}),e[56]=t,e[57]=X);let Z;e[58]!==O||e[59]!==x||e[60]!==Y||e[61]!==X?(Z=(0,m.jsx)(a,{id:`settings-terminal-autoapprove-toggle`,checked:x,onCheckedChange:O,disabled:Y,"aria-label":X,"data-testid":`settings-terminal-autoapprove-toggle`}),e[58]=O,e[59]=x,e[60]=Y,e[61]=X,e[62]=Z):Z=e[62];let Q;e[63]!==J||e[64]!==Z?(Q=(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[J,Z]}),e[63]=J,e[64]=Z,e[65]=Q):Q=e[65];let $;return e[66]!==B||e[67]!==Q||e[68]!==j?($=(0,m.jsxs)(`section`,{"aria-labelledby":`settings-terminal-title`,className:`space-y-3`,"data-field":`section:terminal`,"data-testid":`settings-terminal`,children:[j,B,Q]}),e[66]=B,e[67]=Q,e[68]=j,e[69]=$):$=e[69],$}function g(){}export{h as TerminalSection};
@@ -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}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./use-installed-clis-CXwm5pk2.js";import{t as o}from"./config-provider-Cs3B2_OX.js";import{t as s}from"./use-live-xterm-theme-CkVAs5Ql.js";import{t as c}from"./ReportBugMenuTrigger-DwuaKFu1.js";import{SessionsHost as l}from"./SessionsHost-BANbRx8e.js";var u=i(),d=e(n(),1),f=t();function p(e){let t=(0,u.c)(9),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i=r===null,a;t[0]===n?a=t[1]:(a=(0,f.jsx)(m,{bridge:n}),t[0]=n,t[1]=a);let s=r===null,l;t[2]===s?l=t[3]:(l=(0,f.jsx)(c,{systemWide:s}),t[2]=s,t[3]=l);let d;return t[4]!==r||t[5]!==i||t[6]!==a||t[7]!==l?(d=(0,f.jsxs)(o,{collabUrl:r,collabTerminal:i,children:[a,l]}),t[4]=r,t[5]=i,t[6]=a,t[7]=l,t[8]=d):d=t[8],d}function m(e){let t=(0,u.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),o=s(i),c=a(),[p,m]=(0,d.useState)(null),_;t[0]===o.background?_=t[1]:(_=(0,f.jsx)(`div`,{ref:m,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:o.background}}),t[0]=o.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==c?(v=(0,f.jsx)(l,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:g,installedClis:c,container:p,isShowing:!0,onRequestEditorFocus:h}),t[2]=n,t[3]=p,t[4]=c,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,f.jsxs)(f.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function h(){}function g(e){e||window.close()}export{p as TerminalWindowApp};
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}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./use-installed-clis-CXwm5pk2.js";import{t as o}from"./config-provider-DBgrt1kx.js";import{t as s}from"./use-live-xterm-theme-CkVAs5Ql.js";import{t as c}from"./ReportBugMenuTrigger-DwuaKFu1.js";import{SessionsHost as l}from"./SessionsHost-DhB6vMF-.js";var u=i(),d=e(n(),1),f=t();function p(e){let t=(0,u.c)(9),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i=r===null,a;t[0]===n?a=t[1]:(a=(0,f.jsx)(m,{bridge:n}),t[0]=n,t[1]=a);let s=r===null,l;t[2]===s?l=t[3]:(l=(0,f.jsx)(c,{systemWide:s}),t[2]=s,t[3]=l);let d;return t[4]!==r||t[5]!==i||t[6]!==a||t[7]!==l?(d=(0,f.jsxs)(o,{collabUrl:r,collabTerminal:i,children:[a,l]}),t[4]=r,t[5]=i,t[6]=a,t[7]=l,t[8]=d):d=t[8],d}function m(e){let t=(0,u.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),o=s(i),c=a(),[p,m]=(0,d.useState)(null),_;t[0]===o.background?_=t[1]:(_=(0,f.jsx)(`div`,{ref:m,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:o.background}}),t[0]=o.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==c?(v=(0,f.jsx)(l,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:g,installedClis:c,container:p,isShowing:!0,onRequestEditorFocus:h}),t[2]=n,t[3]=p,t[4]=c,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,f.jsxs)(f.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function h(){}function g(e){e||window.close()}export{p as TerminalWindowApp};
@@ -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{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{_ as o,v as s}from"./constants-upload-CVKO8P4d.js";import{An as c,Gn as l,n as u,qn as d}from"./CodeMirrorPropInput-Cza70VJH.js";import{Ct as f,J as p,M as m,Tt as h}from"./dist-D2SphF3p.js";import{t as g}from"./cm-theme-Cvtw80TE.js";import{t as _}from"./dist-6WGIsHaB.js";import{t as v}from"./text-viewer-languages-i07xql9H.js";import{t as y}from"./src-CaHEUw28.js";import{t as b}from"./doc-undo-manager-szCxH80V.js";var x=a(),S=e(n(),1),C=t(),w=g({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),T=g({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function E(e){let t=(0,x.c)(18),{docName:n,provider:a}=e,{_:g}=r(),E=n.slice(n.lastIndexOf(`/`)+1),D=(0,S.useRef)(null),{resolvedTheme:O}=i(),k,A;t[0]===a?(k=t[1],A=t[2]):(A=a.document.getText(`source`),k=b(a,A),t[0]=a,t[1]=k,t[2]=A);let j=k,M;t[3]!==n||t[4]!==a.awareness||t[5]!==O||t[6]!==j||t[7]!==A?(M=()=>{let e=D.current;if(!e)return;let t=O===`dark`?w:T,r=new f,i=new f,g=(o[c(n)]??s(c(n)))!==null&&c(n)!==``,b=new p({state:h.create({doc:A.toString(),extensions:[_,y(A,a.awareness,{undoManager:j}),r.of([]),m(u),i.of(g?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e});l(n,b,`textDocEditor`);let x=!1,S=c(n)||null;return S&&v(S,o[S]??s(S)).then(e=>{x||!e||b.dispatch({effects:r.reconfigure(e)})}),()=>{x=!0,d(n,b),b.destroy()}},t[3]=n,t[4]=a.awareness,t[5]=O,t[6]=j,t[7]=A,t[8]=M):M=t[8];let N;t[9]!==n||t[10]!==a||t[11]!==O||t[12]!==j||t[13]!==A?(N=[A,a,O,n,j],t[9]=n,t[10]=a,t[11]=O,t[12]=j,t[13]=A,t[14]=N):N=t[14],(0,S.useEffect)(M,N);let P=g({id:`xAlHfe`,values:{basename:E}}),F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,C.jsx)(`div`,{ref:D,className:`min-h-0 flex-1 overflow-auto`}),t[15]=F):F=t[15];let I;return t[16]===P?I=t[17]:(I=(0,C.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":P,"data-text-doc-editor":``,children:F}),t[16]=P,t[17]=I),I}export{E as TextDocEditor};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{_ as o,v as s}from"./constants-upload-CVKO8P4d.js";import{An as c,Gn as l,n as u,qn as d}from"./CodeMirrorPropInput-BTCkQ8gy.js";import{Ct as f,J as p,M as m,Tt as h}from"./dist-D2SphF3p.js";import{t as g}from"./cm-theme-Cvtw80TE.js";import{t as _}from"./dist-6WGIsHaB.js";import{t as v}from"./text-viewer-languages-i07xql9H.js";import{t as y}from"./src-COG_7U42.js";import{t as b}from"./doc-undo-manager-DGQuNlgn.js";var x=a(),S=e(n(),1),C=t(),w=g({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),T=g({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function E(e){let t=(0,x.c)(18),{docName:n,provider:a}=e,{_:g}=r(),E=n.slice(n.lastIndexOf(`/`)+1),D=(0,S.useRef)(null),{resolvedTheme:O}=i(),k,A;t[0]===a?(k=t[1],A=t[2]):(A=a.document.getText(`source`),k=b(a,A),t[0]=a,t[1]=k,t[2]=A);let j=k,M;t[3]!==n||t[4]!==a.awareness||t[5]!==O||t[6]!==j||t[7]!==A?(M=()=>{let e=D.current;if(!e)return;let t=O===`dark`?w:T,r=new f,i=new f,g=(o[c(n)]??s(c(n)))!==null&&c(n)!==``,b=new p({state:h.create({doc:A.toString(),extensions:[_,y(A,a.awareness,{undoManager:j}),r.of([]),m(u),i.of(g?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e});l(n,b,`textDocEditor`);let x=!1,S=c(n)||null;return S&&v(S,o[S]??s(S)).then(e=>{x||!e||b.dispatch({effects:r.reconfigure(e)})}),()=>{x=!0,d(n,b),b.destroy()}},t[3]=n,t[4]=a.awareness,t[5]=O,t[6]=j,t[7]=A,t[8]=M):M=t[8];let N;t[9]!==n||t[10]!==a||t[11]!==O||t[12]!==j||t[13]!==A?(N=[A,a,O,n,j],t[9]=n,t[10]=a,t[11]=O,t[12]=j,t[13]=A,t[14]=N):N=t[14],(0,S.useEffect)(M,N);let P=g({id:`xAlHfe`,values:{basename:E}}),F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,C.jsx)(`div`,{ref:D,className:`min-h-0 flex-1 overflow-auto`}),t[15]=F):F=t[15];let I;return t[16]===P?I=t[17]:(I=(0,C.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":P,"data-text-doc-editor":``,children:F}),t[16]=P,t[17]=I),I}export{E as TextDocEditor};