@inkeep/open-knowledge 0.46.0-beta.4 → 0.46.0-beta.5

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 (112) hide show
  1. package/dist/{acp-harness-probe-BQ3_wze1.mjs → acp-harness-probe-z0k-zB9k.mjs} +2 -2
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/cli.mjs +16 -16
  5. package/dist/constants-tslCao45.mjs +2 -0
  6. package/dist/{git-handle-BnrTPYj_.mjs → git-handle-CK_JXuyw.mjs} +2 -2
  7. package/dist/git-handle-DyS9-xsk.mjs +1 -0
  8. package/dist/index.mjs +1 -1
  9. package/dist/{init-D0wKKFay.mjs → init-B0r5j8e-.mjs} +4 -4
  10. package/dist/init-CZkiXXqU.mjs +1 -0
  11. package/dist/{launch-json-removal-CmpnCINi.mjs → launch-json-removal-DuEviY27.mjs} +2 -2
  12. package/dist/{loader-Sk1Z2HXI.mjs → loader-17-u4oG7.mjs} +2 -2
  13. package/dist/loader-BUBYD2vK.mjs +1 -0
  14. package/dist/md-manager-BWTSpVXC.mjs +2 -0
  15. package/dist/{open-browser-DZWA0mkS.mjs → open-browser-BHXl6F9O.mjs} +2 -2
  16. package/dist/parse-worker.mjs +1 -1
  17. package/dist/preview-B82KOKlR.mjs +1 -0
  18. package/dist/{preview-B4nElYVr.mjs → preview-D9rdyPNb.mjs} +2 -2
  19. package/dist/public/assets/{ActivityModeContent-DKkJMuA9.js → ActivityModeContent-BquAhT5x.js} +1 -1
  20. package/dist/public/assets/{AgentDiffPane-DkzTKjWa.js → AgentDiffPane-6bk9bV9U.js} +1 -1
  21. package/dist/public/assets/{AgentThreadClientBinder-BqONUtGD.js → AgentThreadClientBinder-u3ZVSSHE.js} +1 -1
  22. package/dist/public/assets/{CodeMirrorPropInput-CyIlgGaP.js → CodeMirrorPropInput-DOcEkWLX.js} +2 -2
  23. package/dist/public/assets/{DocumentContext-QeD0oigI.js → DocumentContext-uE-Jpe8-.js} +10 -10
  24. package/dist/public/assets/{EditorModeToggle-12SdK7ya.js → EditorModeToggle-DBmNyzRU.js} +1 -1
  25. package/dist/public/assets/{EnableSyncConfirmDialog-GUnrwfa0.js → EnableSyncConfirmDialog-Dufpw3Xm.js} +1 -1
  26. package/dist/public/assets/FeedbackForm-BieBWPdz.js +1 -0
  27. package/dist/public/assets/{GraphPanel-DE5iijrO.js → GraphPanel-DZMLD8ni.js} +2 -2
  28. package/dist/public/assets/{LintConfigEditor-BNN0UkHw.js → LintConfigEditor-k9WOKYkq.js} +1 -1
  29. package/dist/public/assets/{ManagedArtifactProperties-Bab8809-.js → ManagedArtifactProperties-DJqeSv57.js} +1 -1
  30. package/dist/public/assets/{McpConsentDialogBody-xnaSaj_X.js → McpConsentDialogBody-CHmK7aXE.js} +1 -1
  31. package/dist/public/assets/{MermaidDocEditor-Bw26glK9.js → MermaidDocEditor-CGsfhioE.js} +1 -1
  32. package/dist/public/assets/PropertyPanel-D_XAZl4d.js +2 -0
  33. package/dist/public/assets/{ReportBugDialogBody-SYqc1dep.js → ReportBugDialogBody-CdEV6nCR.js} +1 -1
  34. package/dist/public/assets/{SchemaConfigEditor-RgV92dU4.js → SchemaConfigEditor-BFx4ZhVm.js} +1 -1
  35. package/dist/public/assets/{SettingsDialogBody-Bhk4NQJN.js → SettingsDialogBody-Chz13SZG.js} +3 -3
  36. package/dist/public/assets/{ShareBranchSwitchDialog-BXjj8rUu.js → ShareBranchSwitchDialog-jGb4KF7T.js} +1 -1
  37. package/dist/public/assets/{ShareReceiveDialog-CXqdzDYu.js → ShareReceiveDialog-C7_nVZOF.js} +1 -1
  38. package/dist/public/assets/{ShareReceiveMissDialog-BaHsueef.js → ShareReceiveMissDialog-Dv1nzqQa.js} +1 -1
  39. package/dist/public/assets/{SkillEditorActions-CDWxVAy1.js → SkillEditorActions-2WrfNbQp.js} +1 -1
  40. package/dist/public/assets/{SourceEditor-CZhPtXfy.js → SourceEditor-CmpVF187.js} +1 -1
  41. package/dist/public/assets/{TerminalPanel-DiVhC52x.js → TerminalPanel-BHN2VN4r.js} +1 -1
  42. package/dist/public/assets/{TerminalSessionsHost-8wTgxl0R.js → TerminalSessionsHost-Yz2cECTk.js} +2 -2
  43. package/dist/public/assets/{TerminalWindowApp-CQunMofw.js → TerminalWindowApp-CntBjoWb.js} +1 -1
  44. package/dist/public/assets/{ThreadView-BI4embLm.js → ThreadView-loAOfVAD.js} +1 -1
  45. package/dist/public/assets/{TimelineDiffPane-Dd-khPXZ.js → TimelineDiffPane-C5gRZMQN.js} +1 -1
  46. package/dist/public/assets/{agent-diff-store-CcwDxQK9.js → agent-diff-store-BvRAZqCN.js} +1 -1
  47. package/dist/public/assets/{agent-visibility-mwTztYpe.js → agent-visibility-DJ6Bc0aU.js} +1 -1
  48. package/dist/public/assets/{auth-state-cache-Bkm-5pQl.js → auth-state-cache-CEu3ZBI_.js} +1 -1
  49. package/dist/public/assets/{client-version-g_nEG2h2.js → client-version-MIkctMik.js} +1 -1
  50. package/dist/public/assets/{comment-chips--aitTdum.js → comment-chips-BYH7v5tl.js} +1 -1
  51. package/dist/public/assets/{config-provider-CedEU5Ch.js → config-provider-B9kQH9zn.js} +2 -2
  52. package/dist/public/assets/{dist-Cv2LF2DL.js → dist-DJbbCXtB.js} +183 -177
  53. package/dist/public/assets/{doc-hash-unBeSU8C.js → doc-hash-BbU2eA08.js} +1 -1
  54. package/dist/public/assets/{documents-events-DJXnk07Z.js → documents-events-C-mYs64z.js} +1 -1
  55. package/dist/public/assets/{file-tree-adapter-C9l0Uy9t.js → file-tree-adapter-c4ru9pmD.js} +1 -1
  56. package/dist/public/assets/{file-tree-utils-Cy6smqXE.js → file-tree-utils-Lc0SvgnU.js} +1 -1
  57. package/dist/public/assets/{index-BnCzVIZM.js → index-CSZTqzu0.js} +11 -11
  58. package/dist/public/assets/{lint-config-client-SBOLqEAH.js → lint-config-client-DJg7YDu3.js} +1 -1
  59. package/dist/public/assets/{markdownlint-rule-browser-u-niNZkQ.js → markdownlint-rule-browser-6yvn3dt6.js} +1 -1
  60. package/dist/public/assets/{navigation-targets-CRrgSRY3.js → navigation-targets-DwSgIIy0.js} +1 -1
  61. package/dist/public/assets/{open-managed-artifact-tab-DKpdEiZk.js → open-managed-artifact-tab-Dpz9X1m_.js} +1 -1
  62. package/dist/public/assets/{pending-receive-nav-store-EO01lM9G.js → pending-receive-nav-store-t5K6mYGs.js} +1 -1
  63. package/dist/public/assets/{prop-types-DDnDOUmp.js → prop-types-65NJPmd-.js} +1 -1
  64. package/dist/public/assets/{receive-store-CCj5OCl8.js → receive-store-C8NL_Ow-.js} +1 -1
  65. package/dist/public/assets/{selection-context-CsoqdVq1.js → selection-context-BNYOSYyM.js} +1 -1
  66. package/dist/public/assets/{skill-actions-4cV_4pjw.js → skill-actions-ByBHG3Gh.js} +1 -1
  67. package/dist/public/assets/{skills-api-141pFhWO.js → skills-api-DWPhWBud.js} +1 -1
  68. package/dist/public/assets/{src-0hFiTIuh.js → src-U1RHfo7d.js} +1 -1
  69. package/dist/public/assets/{tag-pill-input-C4VKdytg.js → tag-pill-input-BHj4spSb.js} +1 -1
  70. package/dist/public/assets/{target-navigation-intent-BzJodEAL.js → target-navigation-intent-B5jnqgZ_.js} +1 -1
  71. package/dist/public/assets/{terminal-launch-events-Bz4DL9DZ.js → terminal-launch-events-CtZeptxC.js} +1 -1
  72. package/dist/public/assets/{terminal-telemetry-CXqhqIkk.js → terminal-telemetry-CvNM4wYv.js} +1 -1
  73. package/dist/public/assets/typing-burst-detector-CZREoy8B.js +8 -0
  74. package/dist/public/assets/{uninstall-9ZXPO59t.js → uninstall-CA1cQCnA.js} +1 -1
  75. package/dist/public/assets/{use-activity-panel-BBGq_DFB.js → use-activity-panel-DWxDopZd.js} +1 -1
  76. package/dist/public/assets/{use-apply-config-color-theme-zM7Oux5u.js → use-apply-config-color-theme-DSCn9I0W.js} +1 -1
  77. package/dist/public/assets/{use-collab-url-81TC8Fvz.js → use-collab-url-CE02D4PJ.js} +1 -1
  78. package/dist/public/assets/{use-live-xterm-theme-DeW6SO6V.js → use-live-xterm-theme-B2MdP4nP.js} +1 -1
  79. package/dist/public/assets/{use-settings-route-KYTTaHV0.js → use-settings-route-BX1P2p9-.js} +1 -1
  80. package/dist/public/assets/{use-terminal-enabled-qjUlZ0f0.js → use-terminal-enabled-BlXFMDFQ.js} +1 -1
  81. package/dist/public/assets/{use-timeline-entry-diff-svkep662.js → use-timeline-entry-diff-BI1BVnmy.js} +1 -1
  82. package/dist/public/assets/{use-workspace-CNU53RmX.js → use-workspace-DcPrrukl.js} +1 -1
  83. package/dist/public/assets/{workspace-paths-DGKkpMQ9.js → workspace-paths-CU85-ZRd.js} +1 -1
  84. package/dist/public/index.html +36 -36
  85. package/dist/public/uninstall.html +2 -2
  86. package/dist/{repair-launch-json-B-4hsfw8.mjs → repair-launch-json-DuW7FPUd.mjs} +2 -2
  87. package/dist/{repair-mcp-configs--yGPDCBl.mjs → repair-mcp-configs-BQGk6jEy.mjs} +2 -2
  88. package/dist/{repair-skills-CH8FwF78.mjs → repair-skills-BHY_AeM4.mjs} +2 -2
  89. package/dist/repair-skills-CUT1NbJx.mjs +1 -0
  90. package/dist/server-lock-CG809RrD.mjs +1 -0
  91. package/dist/{server-lock-D6rSSnhg.mjs → server-lock-D7crxuP7.mjs} +2 -2
  92. package/dist/{src-CwNOE4ri.mjs → src-D4iCDwsy.mjs} +1 -1
  93. package/dist/{src-y0VSl78g.mjs → src-Dgr9qydu.mjs} +4 -4
  94. package/dist/{src-2StQCkyf.mjs → src-DmtkLnli.mjs} +26 -20
  95. package/dist/src-T1lGYBC1.mjs +3275 -0
  96. package/dist/{start-D-Yu2Dgc.mjs → start-BCUq2L4a.mjs} +3 -3
  97. package/dist/start-p5gJUJY6.mjs +1 -0
  98. package/dist/{write-project-skill-W6wm8WGO.mjs → write-project-skill-BzhJIXSv.mjs} +3 -3
  99. package/package.json +4 -4
  100. package/dist/constants-7P_R76Oj.mjs +0 -2
  101. package/dist/git-handle-CHFcUjId.mjs +0 -1
  102. package/dist/init-C9mmgvW-.mjs +0 -1
  103. package/dist/loader-D297fMOD.mjs +0 -1
  104. package/dist/md-manager-B9dAVpPF.mjs +0 -2
  105. package/dist/preview-DacomZcF.mjs +0 -1
  106. package/dist/public/assets/FeedbackForm-B34f3kZF.js +0 -1
  107. package/dist/public/assets/PropertyPanel-ANMzlUf0.js +0 -2
  108. package/dist/public/assets/typing-burst-detector-DuRvcTVz.js +0 -8
  109. package/dist/repair-skills-C40390Fl.mjs +0 -1
  110. package/dist/server-lock-RCr-Pegf.mjs +0 -1
  111. package/dist/src-DV_Dbu6a.mjs +0 -3275
  112. package/dist/start-Bc5XMp-q.mjs +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{K as r,it as i,rt as a}from"./dist-Cv2LF2DL.js";var o=n(),s=e(t(),1),c=`open-knowledge:lint-config-changed`;function l(){window.dispatchEvent(new CustomEvent(c))}function u(e){let t=()=>e();return window.addEventListener(c,t),()=>window.removeEventListener(c,t)}async function d(e){try{let t=e===void 0?``:`?doc=${encodeURIComponent(e)}`,n=await fetch(`/api/lint/config${t}`);if(!n.ok)return null;let r=await n.json().catch(()=>null),i=a.safeParse(r);return i.success?i.data:(console.warn(`[lint] lint-config response failed schema validation`,i.error.issues),null)}catch{return null}}async function f(e){return(await d(e))?.effective??null}async function p(e){try{let t=await fetch(`/api/lint/fix`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({docName:e})});if(!t.ok){let e=await t.json().catch(()=>null);return{ok:!1,errorDetail:typeof e?.title==`string`?e.title:null}}let n=await t.json().catch(()=>null),r=i.safeParse(n);return r.success?{ok:!0,result:r.data}:(console.warn(`[lint] fix response failed schema validation`,r.error.issues),{ok:!1,errorDetail:null})}catch{return{ok:!1,errorDetail:null}}}async function m(e,t){try{let n=await fetch(`/api/lint/markdownlint-config`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({ruleId:e,value:t})});if(!n.ok){let e=await n.json().catch(()=>null);return{ok:!1,errorDetail:typeof e?.title==`string`?e.title:null}}let r=await n.json().catch(()=>null),i=a.safeParse(r);return i.success?{ok:!0,response:i.data}:{ok:!1,errorDetail:null}}catch{return{ok:!1,errorDetail:null}}}async function h(e){try{let t=await fetch(`/api/lint/frontmatter-schema`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);return{ok:!1,errorDetail:typeof e?.title==`string`?e.title:null}}let n=a.safeParse(await t.json().catch(()=>null));return n.success?{ok:!0,response:n.data}:{ok:!1,errorDetail:null}}catch{return{ok:!1,errorDetail:null}}}function g(e){return e.length>0?e:void 0}async function _(e,t,n,r=[]){return h({file:e,field:t,constraint:n,parentPath:g(r)})}async function v(){try{let e=await fetch(`/api/lint/frontmatter-schemas`);if(!e.ok)return[];let t=await e.json().catch(()=>null),n=r.safeParse(t);return n.success?n.data.schemas:(console.warn(`[lint] frontmatter-schemas response failed schema validation`,n.error.issues),[])}catch{return[]}}async function y(e){let t=await h({file:e});return t.ok&&l(),t}async function b(e,t,n=[]){return h({file:e,field:t,removeField:!0,parentPath:g(n)})}async function x(e,t,n,r=[]){return h({file:e,field:t,renameTo:n,parentPath:g(r)})}async function S(e){let t=await h({file:e,delete:!0});return t.ok&&l(),t}function C(){let e=(0,o.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,s.useState)(t),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{v().then(r)},e[1]=i):i=e[1];let a=i,c,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1,t=()=>{v().then(t=>{e||r(t)})};t();let n=u(t);return()=>{e=!0,n()}},l=[],e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,s.useEffect)(c,l);let d;return e[4]===n?d=e[5]:(d={schemas:n,refresh:a},e[4]=n,e[5]=d),d}function w(e){let t=(0,o.c)(5),[n,r]=(0,s.useState)(null),i,a;t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(null);return}let t=!1,n=()=>{d(e).then(e=>{t||r(e)})};n();let i=u(n);return()=>{t=!0,i()}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,s.useEffect)(i,a);let c;return t[3]===n?c=t[4]:(c={data:n},t[3]=n,t[4]=c),c}function T(){let e=(0,o.c)(4),[t,n]=(0,s.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=!1,t=()=>{d().then(t=>{e||n(t)})};t();let r=u(t);return()=>{e=!0,r()}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,s.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={data:t},e[2]=t,e[3]=a),a}export{p as a,u as c,T as d,_ as f,f as i,w as l,S as n,b as o,m as p,l as r,x as s,y as t,C as u};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{K as r,it as i,rt as a}from"./dist-DJbbCXtB.js";var o=n(),s=e(t(),1),c=`open-knowledge:lint-config-changed`;function l(){window.dispatchEvent(new CustomEvent(c))}function u(e){let t=()=>e();return window.addEventListener(c,t),()=>window.removeEventListener(c,t)}async function d(e){try{let t=e===void 0?``:`?doc=${encodeURIComponent(e)}`,n=await fetch(`/api/lint/config${t}`);if(!n.ok)return null;let r=await n.json().catch(()=>null),i=a.safeParse(r);return i.success?i.data:(console.warn(`[lint] lint-config response failed schema validation`,i.error.issues),null)}catch{return null}}async function f(e){return(await d(e))?.effective??null}async function p(e){try{let t=await fetch(`/api/lint/fix`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({docName:e})});if(!t.ok){let e=await t.json().catch(()=>null);return{ok:!1,errorDetail:typeof e?.title==`string`?e.title:null}}let n=await t.json().catch(()=>null),r=i.safeParse(n);return r.success?{ok:!0,result:r.data}:(console.warn(`[lint] fix response failed schema validation`,r.error.issues),{ok:!1,errorDetail:null})}catch{return{ok:!1,errorDetail:null}}}async function m(e,t){try{let n=await fetch(`/api/lint/markdownlint-config`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({ruleId:e,value:t})});if(!n.ok){let e=await n.json().catch(()=>null);return{ok:!1,errorDetail:typeof e?.title==`string`?e.title:null}}let r=await n.json().catch(()=>null),i=a.safeParse(r);return i.success?{ok:!0,response:i.data}:{ok:!1,errorDetail:null}}catch{return{ok:!1,errorDetail:null}}}async function h(e){try{let t=await fetch(`/api/lint/frontmatter-schema`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);return{ok:!1,errorDetail:typeof e?.title==`string`?e.title:null}}let n=a.safeParse(await t.json().catch(()=>null));return n.success?{ok:!0,response:n.data}:{ok:!1,errorDetail:null}}catch{return{ok:!1,errorDetail:null}}}function g(e){return e.length>0?e:void 0}async function _(e,t,n,r=[]){return h({file:e,field:t,constraint:n,parentPath:g(r)})}async function v(){try{let e=await fetch(`/api/lint/frontmatter-schemas`);if(!e.ok)return[];let t=await e.json().catch(()=>null),n=r.safeParse(t);return n.success?n.data.schemas:(console.warn(`[lint] frontmatter-schemas response failed schema validation`,n.error.issues),[])}catch{return[]}}async function y(e){let t=await h({file:e});return t.ok&&l(),t}async function b(e,t,n=[]){return h({file:e,field:t,removeField:!0,parentPath:g(n)})}async function x(e,t,n,r=[]){return h({file:e,field:t,renameTo:n,parentPath:g(r)})}async function S(e){let t=await h({file:e,delete:!0});return t.ok&&l(),t}function C(){let e=(0,o.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,s.useState)(t),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{v().then(r)},e[1]=i):i=e[1];let a=i,c,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1,t=()=>{v().then(t=>{e||r(t)})};t();let n=u(t);return()=>{e=!0,n()}},l=[],e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,s.useEffect)(c,l);let d;return e[4]===n?d=e[5]:(d={schemas:n,refresh:a},e[4]=n,e[5]=d),d}function w(e){let t=(0,o.c)(5),[n,r]=(0,s.useState)(null),i,a;t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(null);return}let t=!1,n=()=>{d(e).then(e=>{t||r(e)})};n();let i=u(n);return()=>{t=!0,i()}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,s.useEffect)(i,a);let c;return t[3]===n?c=t[4]:(c={data:n},t[3]=n,t[4]=c),c}function T(){let e=(0,o.c)(4),[t,n]=(0,s.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=!1,t=()=>{d().then(t=>{e||n(t)})};t();let r=u(t);return()=>{e=!0,r()}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,s.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={data:t},e[2]=t,e[3]=a),a}export{p as a,u as c,T as d,_ as f,f as i,w as l,S as n,b as o,m as p,l as r,x as s,y as t,C as u};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-Gol9BgNB.js";import{i as s,n as c,t as l}from"./tooltip-B4J7VHmA.js";import{n as u,r as d,t as f}from"./collapsible-B1mS1n9y.js";import{t as p}from"./checkbox-BkZH9Oy1.js";import{t as m}from"./label-DyipnO5I.js";import{a as h,i as g,n as _,o as v,r as y,t as ee}from"./switch-DYic2V-1.js";import{$n as b,Ot as x,Wn as S,ct as C}from"./dist-Cv2LF2DL.js";import{t as te}from"./arrow-up-right-obRIg3Sv.js";import{t as ne}from"./chevron-right-C8oTR6gu.js";import{t as w}from"./info-yKMseklR.js";import{c as T,r as E}from"./field-BNyAQHKf.js";import{n as D}from"./dist-B8I5m7M1.js";import{t as O}from"./input-D4OPkja2.js";import{t as k}from"./badge-DXHoKHez.js";import{t as A}from"./external-link-Ct0_ujyY.js";import{t as j}from"./skeleton-Mo1oLtEu.js";import{d as M,p as N,r as re}from"./lint-config-client-SBOLqEAH.js";import{t as P}from"./tag-pill-input-C4VKdytg.js";var F=a(),I=e(n(),1),L=t(),R={};function ie(e){let t=(0,F.c)(5),n=R[e.ruleId];if(n!==void 0){let r;return t[0]!==n||t[1]!==e?(r=(0,L.jsx)(n,{...e}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}let r;return t[3]===e?r=t[4]:(r=(0,L.jsx)(z,{...e}),t[3]=e,t[4]=r),r}function z(e){let t=(0,F.c)(65),{ruleId:n,spec:i,value:a,disabled:o,onChange:s}=e,c=`rule-option-${n}-${i.key}`,l=`${c}-description`,u;t[0]!==c||t[1]!==i.key||t[2]!==i.type?(u=i.type===`unsupported`?(0,L.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:i.key}):(0,L.jsx)(m,{htmlFor:c,className:`font-mono text-sm font-medium`,children:i.key}),t[0]=c,t[1]=i.key,t[2]=i.type,t[3]=u):u=t[3];let d;t[4]===i.default?d=t[5]:(d=i.default===void 0?null:(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(r,{id:`KtACeE`,values:{0:H(i.default)},components:{0:(0,L.jsx)(`code`,{className:`font-mono`})}})]}),t[4]=i.default,t[5]=d);let f;t[6]!==l||t[7]!==i.description||t[8]!==d?(f=(0,L.jsxs)(E,{id:l,children:[i.description,d]}),t[6]=l,t[7]=i.description,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==u||t[11]!==f?(p=(0,L.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[u,f]}),t[10]=u,t[11]=f,t[12]=p):p=t[12];let h=p,g=o===!0,_;t[13]!==c||t[14]!==l||t[15]!==s||t[16]!==g?(_={controlId:c,descriptionId:l,disabled:g,onChange:s},t[13]=c,t[14]=l,t[15]=s,t[16]=g,t[17]=_):_=t[17];let v=_;switch(i.type){case`boolean`:{let e;t[18]!==v||t[19]!==i||t[20]!==a?(e=(0,L.jsx)(U,{...v,spec:i,value:a}),t[18]=v,t[19]=i,t[20]=a,t[21]=e):e=t[21];let n;return t[22]!==c||t[23]!==h||t[24]!==e?(n=(0,L.jsx)(B,{testId:c,header:h,children:e}),t[22]=c,t[23]=h,t[24]=e,t[25]=n):n=t[25],n}case`enum`:{let e;t[26]!==v||t[27]!==i||t[28]!==a?(e=(0,L.jsx)(W,{...v,spec:i,value:a}),t[26]=v,t[27]=i,t[28]=a,t[29]=e):e=t[29];let n;return t[30]!==c||t[31]!==h||t[32]!==e?(n=(0,L.jsx)(B,{testId:c,header:h,children:e}),t[30]=c,t[31]=h,t[32]=e,t[33]=n):n=t[33],n}case`integer`:{let e;t[34]!==v||t[35]!==i||t[36]!==a?(e=(0,L.jsx)(G,{...v,spec:i,value:a}),t[34]=v,t[35]=i,t[36]=a,t[37]=e):e=t[37];let n;return t[38]!==c||t[39]!==h||t[40]!==e?(n=(0,L.jsx)(B,{testId:c,header:h,children:e}),t[38]=c,t[39]=h,t[40]=e,t[41]=n):n=t[41],n}case`string`:{let e;t[42]!==v||t[43]!==i||t[44]!==a?(e=(0,L.jsx)(K,{...v,spec:i,value:a}),t[42]=v,t[43]=i,t[44]=a,t[45]=e):e=t[45];let n;return t[46]!==c||t[47]!==h||t[48]!==e?(n=(0,L.jsx)(V,{testId:c,header:h,children:e}),t[46]=c,t[47]=h,t[48]=e,t[49]=n):n=t[49],n}case`string-array`:{let e;t[50]!==v||t[51]!==i||t[52]!==a?(e=(0,L.jsx)(q,{...v,spec:i,value:a}),t[50]=v,t[51]=i,t[52]=a,t[53]=e):e=t[53];let n;return t[54]!==c||t[55]!==h||t[56]!==e?(n=(0,L.jsx)(V,{testId:c,header:h,children:e}),t[54]=c,t[55]=h,t[56]=e,t[57]=n):n=t[57],n}case`unsupported`:{let e=`${c}-unsupported`,n;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,L.jsx)(r,{id:`NQXwDy`}),t[58]=n):n=t[58];let i;t[59]===e?i=t[60]:(i=(0,L.jsx)(k,{variant:`gray`,"data-testid":e,children:n}),t[59]=e,t[60]=i);let a;return t[61]!==c||t[62]!==h||t[63]!==i?(a=(0,L.jsx)(B,{testId:c,header:h,children:i}),t[61]=c,t[62]=h,t[63]=i,t[64]=a):a=t[64],a}default:return i}}function B(e){let t=(0,F.c)(6),{testId:n,header:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,L.jsx)(`div`,{className:`shrink-0`,children:i}),t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==a||t[4]!==n?(o=(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,"data-testid":n,children:[r,a]}),t[2]=r,t[3]=a,t[4]=n,t[5]=o):o=t[5],o}function V(e){let t=(0,F.c)(4),{testId:n,header:r,children:i}=e,a;return t[0]!==i||t[1]!==r||t[2]!==n?(a=(0,L.jsxs)(`div`,{className:`space-y-1.5`,"data-testid":n,children:[r,i]}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function H(e){return JSON.stringify(e)}function U(e){let t=(0,F.c)(8),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c=typeof r==`boolean`?r:n.default??!1,l;t[0]===s?l=t[1]:(l=e=>s(e),t[0]=s,t[1]=l);let u;return t[2]!==c||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==l?(u=(0,L.jsx)(ee,{id:i,checked:c,disabled:o,"aria-describedby":a,onCheckedChange:l}),t[2]=c,t[3]=i,t[4]=a,t[5]=o,t[6]=l,t[7]=u):u=t[7],u}function W(e){let t=(0,F.c)(16),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c=typeof r==`string`?r:n.default??``,l;t[0]===s?l=t[1]:(l=e=>s(e),t[0]=s,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,L.jsx)(v,{}),t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==a?(d=(0,L.jsx)(h,{id:i,"aria-describedby":a,className:`w-48`,children:u}),t[3]=i,t[4]=a,t[5]=d):d=t[5];let f;t[6]===n.enum?f=t[7]:(f=n.enum.map(ae),t[6]=n.enum,t[7]=f);let p;t[8]===f?p=t[9]:(p=(0,L.jsx)(y,{children:f}),t[8]=f,t[9]=p);let m;return t[10]!==c||t[11]!==o||t[12]!==l||t[13]!==d||t[14]!==p?(m=(0,L.jsxs)(_,{value:c,onValueChange:l,disabled:o,children:[d,p]}),t[10]=c,t[11]=o,t[12]=l,t[13]=d,t[14]=p,t[15]=m):m=t[15],m}function ae(e){return(0,L.jsx)(g,{value:e,children:e},e)}function G(e){let t=(0,F.c)(22),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c=typeof r==`number`?r:n.default,l=c===void 0?``:String(c),[u,d]=(0,I.useState)(l),f=(0,I.useRef)(c),p,m;t[0]===c?(p=t[1],m=t[2]):(p=()=>{f.current!==c&&(d(c===void 0?``:String(c)),f.current=c)},m=[c],t[0]=c,t[1]=p,t[2]=m),(0,I.useEffect)(p,m);let h;t[3]!==c||t[4]!==l||t[5]!==s||t[6]!==u||t[7]!==n.maximum||t[8]!==n.minimum?(h=()=>{if(u.trim()===``){d(l);return}let e=Number(u);if(!Number.isFinite(e)){d(l);return}let t=Math.round(e);n.minimum!==void 0&&t<n.minimum&&(t=n.minimum),n.maximum!==void 0&&t>n.maximum&&(t=n.maximum),d(String(t)),t!==c&&s(t)},t[3]=c,t[4]=l,t[5]=s,t[6]=u,t[7]=n.maximum,t[8]=n.minimum,t[9]=h):h=t[9];let g=h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===g?v=t[12]:(v=e=>{e.key===`Enter`&&(e.preventDefault(),g())},t[11]=g,t[12]=v);let y;return t[13]!==g||t[14]!==i||t[15]!==a||t[16]!==o||t[17]!==u||t[18]!==n.maximum||t[19]!==n.minimum||t[20]!==v?(y=(0,L.jsx)(O,{id:i,type:`number`,value:u,min:n.minimum,max:n.maximum,disabled:o,"aria-describedby":a,onChange:_,onBlur:g,onKeyDown:v,className:`h-8 w-28 text-sm tabular-nums`}),t[13]=g,t[14]=i,t[15]=a,t[16]=o,t[17]=u,t[18]=n.maximum,t[19]=n.minimum,t[20]=v,t[21]=y):y=t[21],y}function K(e){let t=(0,F.c)(17),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c=typeof r==`string`?r:n.default??``,[l,u]=(0,I.useState)(c),d=(0,I.useRef)(c),f,p;t[0]===c?(f=t[1],p=t[2]):(f=()=>{d.current!==c&&(u(c),d.current=c)},p=[c],t[0]=c,t[1]=f,t[2]=p),(0,I.useEffect)(f,p);let m;t[3]!==c||t[4]!==s||t[5]!==l?(m=()=>{l!==c&&s(l)},t[3]=c,t[4]=s,t[5]=l,t[6]=m):m=t[6];let h=m,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>u(e.target.value),t[7]=g):g=t[7];let _;t[8]===h?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),h())},t[8]=h,t[9]=_);let v;return t[10]!==h||t[11]!==i||t[12]!==a||t[13]!==o||t[14]!==l||t[15]!==_?(v=(0,L.jsx)(O,{id:i,value:l,disabled:o,"aria-describedby":a,onChange:g,onBlur:h,onKeyDown:_,className:`h-8 font-mono text-sm`}),t[10]=h,t[11]=i,t[12]=a,t[13]=o,t[14]=l,t[15]=_,t[16]=v):v=t[16],v}function q(e){let t=(0,F.c)(11),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c;t[0]!==n||t[1]!==r?(c=Array.isArray(r)?r.filter(J):[...n.default??[]],t[0]=n,t[1]=r,t[2]=c):c=t[2];let l=c,u;t[3]===s?u=t[4]:(u=e=>s(e),t[3]=s,t[4]=u);let d;return t[5]!==i||t[6]!==a||t[7]!==o||t[8]!==l||t[9]!==u?(d=(0,L.jsx)(P,{id:i,value:l,grammar:`free-text`,disabled:o,"aria-describedby":a,onChange:u}),t[5]=i,t[6]=a,t[7]=o,t[8]=l,t[9]=u,t[10]=d):d=t[10],d}function J(e){return typeof e==`string`}function oe(e){let t=(0,F.c)(53),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{hideConfigSourceNote:a,initialRuleQuery:o}=n,s=a===void 0?!1:a,{_:c}=i(),{data:l}=M(),h=l!==null,g;t[2]===l?.effective.plugins.markdownlint.rules?g=t[3]:(g=l?.effective.plugins.markdownlint.rules??{},t[2]=l?.effective.plugins.markdownlint.rules,t[3]=g);let _=g,v=l?.configFile??null,[y,ee]=(0,I.useState)(o?.query??``),[b,te]=(0,I.useState)(!1),T=o?.nonce,E=o?.query,k,A;t[4]!==T||t[5]!==E?(k=()=>{T===void 0||E===void 0||ee(E)},A=[T,E],t[4]=T,t[5]=E,t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,I.useEffect)(k,A);let P;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[8]=P):P=t[8];let[R,ie]=(0,I.useState)(P),z;t[9]===c?z=t[10]:(z=function(e,t){N(e,t).then(e=>{if(!e.ok){D.error(e.errorDetail??c({id:`2G-56b`}));return}re()})},t[9]=c,t[10]=z);let B=z,V;t[11]!==b||t[12]!==y?(V=y.trim()!==``||b,t[11]=b,t[12]=y,t[13]=V):V=t[13];let H=V,U;if(t[14]!==c||t[15]!==R||t[16]!==v||t[17]!==H||t[18]!==s||t[19]!==b||t[20]!==h||t[21]!==_||t[22]!==y||t[23]!==B){let e;t[25]!==v||t[26]!==b||t[27]!==_||t[28]!==y?(e=e=>le(e,y)&&(!b||se(_,v,e.id)),t[25]=v,t[26]=b,t[27]=_,t[28]=y,t[29]=e):e=t[29];let n=C.filter(e),i=x.map(e=>({category:e,entries:n.filter(t=>S(t)===e)})).filter(Y),a;t[30]!==v||t[31]!==s||t[32]!==h?(a=!s&&(h?v?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`markdownlint-config-source-note`,children:(0,L.jsx)(r,{id:`V2Gmie`,values:{configFile:v},components:{0:(0,L.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}):(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,L.jsx)(r,{id:`Z6rrjc`,components:{0:(0,L.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}),(0,L.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md border border-dashed p-2.5 text-sm text-muted-foreground`,"data-testid":`markdownlint-no-file-disclaimer`,children:[(0,L.jsx)(w,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0`}),(0,L.jsx)(`span`,{children:(0,L.jsx)(r,{id:`Te6sK2`,components:{0:(0,L.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]})]}):(0,L.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,"data-testid":`markdownlint-rule-browser-config-loading`,children:[(0,L.jsx)(j,{className:`h-4 w-full`}),(0,L.jsx)(j,{className:`h-4 w-2/3`})]})),t[30]=v,t[31]=s,t[32]=h,t[33]=a):a=t[33];let o;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`markdownlint-rule-browser-legend`,children:(0,L.jsx)(r,{id:`zYp8Sr`,components:{0:(0,L.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,L.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}),t[34]=o):o=t[34];let l;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>ee(e.target.value),t[35]=l):l=t[35];let g;t[36]===c?g=t[37]:(g=c({id:`l-4nnw`}),t[36]=c,t[37]=g);let T;t[38]===c?T=t[39]:(T=c({id:`yf5auF`}),t[38]=c,t[39]=T);let E;t[40]!==y||t[41]!==g||t[42]!==T?(E=(0,L.jsx)(O,{value:y,onChange:l,placeholder:g,"aria-label":T,className:`h-8`,"data-testid":`markdownlint-rule-search`}),t[40]=y,t[41]=g,t[42]=T,t[43]=E):E=t[43];let D;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>te(e===!0),t[44]=D):D=t[44];let k;t[45]===b?k=t[46]:(k=(0,L.jsx)(p,{id:`markdownlint-only-modified`,checked:b,onCheckedChange:D,"data-testid":`markdownlint-only-modified`}),t[45]=b,t[46]=k);let A;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,L.jsx)(m,{htmlFor:`markdownlint-only-modified`,className:`text-sm font-normal`,children:(0,L.jsx)(r,{id:`ccNps_`})}),t[47]=A):A=t[47];let M;t[48]===k?M=t[49]:(M=(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[k,A]}),t[48]=k,t[49]=M);let N;t[50]!==E||t[51]!==M?(N=(0,L.jsxs)(`div`,{className:`flex items-center gap-4`,children:[E,M]}),t[50]=E,t[51]=M,t[52]=N):N=t[52],U=(0,L.jsxs)(`div`,{className:`space-y-3`,"data-testid":`settings-linting-markdownlint-rules`,children:[a,o,N,i.length===0?(0,L.jsx)(`p`,{className:`rounded-md border border-dashed p-3 text-sm text-muted-foreground`,"data-testid":`markdownlint-rule-browser-empty`,children:(0,L.jsx)(r,{id:`RfilGt`})}):(0,L.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>{let{category:t,entries:n}=e,i=n.filter(e=>ue($(_,e.id))).length;return(0,L.jsxs)(f,{open:H||!R.includes(t),onOpenChange:e=>ie(e?R.filter(e=>e!==t):[...R,t]),children:[(0,L.jsxs)(d,{className:`group flex w-full items-center gap-2 rounded-md px-1.5 py-1.5 text-sm font-medium hover:bg-muted/50`,"data-testid":`markdownlint-rule-category-${Q(t)}`,children:[(0,L.jsx)(ne,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),(0,L.jsx)(Z,{category:t}),(0,L.jsx)(`span`,{className:`ms-auto text-xs font-normal text-muted-foreground tabular-nums`,children:(0,L.jsx)(r,{id:`NgZwB0`,values:{0:n.length,enabledCount:i}})})]}),(0,L.jsx)(u,{children:(0,L.jsx)(`div`,{className:`mt-1 divide-y rounded-md border`,children:n.map(e=>(0,L.jsx)(X,{rule:e,value:$(_,e.id),modified:se(_,v,e.id),ready:h,onWrite:t=>B(e.id,t)},e.id))})})]},t)})})]}),t[14]=c,t[15]=R,t[16]=v,t[17]=H,t[18]=s,t[19]=b,t[20]=h,t[21]=_,t[22]=y,t[23]=B,t[24]=U}else U=t[24];return U}function Y(e){return e.entries.length>0}function X(e){let t=(0,F.c)(96),{rule:n,value:a,modified:p,ready:m,onWrite:h}=e,{_:g}=i(),_;t[0]===a?_=t[1]:(_=ue(a),t[0]=a,t[1]=_);let v=_,y;t[2]===a?y=t[3]:(y=ce(a),t[2]=a,t[3]=y);let b=y,x,S,C,w,E,D,O;if(t[4]!==n.id||t[5]!==n.name||t[6]!==a){S=de(a),x=f,O=`markdownlint-rule-row-${n.id}`,E=`flex items-center justify-between gap-3 px-3 py-2`;let e=`markdownlint-rule-expand-${n.id}`,i;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,L.jsx)(ne,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[14]=i):i=t[14];let o;t[15]===n.name?o=t[16]:(o=(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:n.name}),t[15]=n.name,t[16]=o),t[17]!==o||t[18]!==e?(D=(0,L.jsxs)(d,{className:`group flex min-w-0 flex-1 items-center gap-1.5 rounded-md py-0.5 text-left hover:bg-muted/50`,"data-testid":e,children:[i,o]}),t[17]=o,t[18]=e,t[19]=D):D=t[19],C=`flex shrink-0 items-center gap-2`,w=S.length>0?(0,L.jsx)(`span`,{id:`settings-linting-markdownlint-options-${n.id}`,className:`text-xs text-muted-foreground`,title:S.join(`, `),"data-testid":`settings-linting-markdownlint-options-${n.id}`,children:(0,L.jsx)(r,{id:`G-h6qN`,values:{0:S.length}})}):null,t[4]=n.id,t[5]=n.name,t[6]=a,t[7]=x,t[8]=S,t[9]=C,t[10]=w,t[11]=E,t[12]=D,t[13]=O}else x=t[7],S=t[8],C=t[9],w=t[10],E=t[11],D=t[12],O=t[13];let j;t[20]!==n.id||t[21]!==b?(j=b===null?null:(0,L.jsx)(k,{variant:`gray`,"data-testid":`markdownlint-rule-severity-${n.id}`,children:b}),t[20]=n.id,t[21]=b,t[22]=j):j=t[22];let M;t[23]!==p||t[24]!==n.id?(M=p?(0,L.jsx)(k,{variant:`outline`,"data-testid":`markdownlint-rule-modified-${n.id}`,children:(0,L.jsx)(r,{id:`tgWuMB`})}):null,t[23]=p,t[24]=n.id,t[25]=M):M=t[25];let N;t[26]!==g||t[27]!==p||t[28]!==h||t[29]!==m||t[30]!==n.id?(N=p?(0,L.jsxs)(l,{children:[(0,L.jsx)(s,{asChild:!0,children:(0,L.jsx)(o,{variant:`ghost`,size:`icon`,className:`h-5 w-5 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,disabled:!m,"aria-label":g({id:`50ORFs`,values:{0:n.id}}),onClick:()=>h(null),children:(0,L.jsx)(T,{className:`size-3.5`})})}),(0,L.jsx)(c,{children:(0,L.jsx)(r,{id:`L-rMC9`})})]}):null,t[26]=g,t[27]=p,t[28]=h,t[29]=m,t[30]=n.id,t[31]=N):N=t[31];let re=`markdownlint-rule-toggle-${n.id}`,P=!m,I;t[32]!==g||t[33]!==v||t[34]!==n.name?(I=g(v?{id:`y5UgU8`,values:{0:n.name}}:{id:`FZtBeR`,values:{0:n.name}}),t[32]=g,t[33]=v,t[34]=n.name,t[35]=I):I=t[35];let R=S.length>0?`settings-linting-markdownlint-options-${n.id}`:void 0,z;t[36]!==h||t[37]!==a?(z=e=>h(fe(a,e)),t[36]=h,t[37]=a,t[38]=z):z=t[38];let B=`markdownlint-rule-toggle-${n.id}`,V;t[39]!==v||t[40]!==re||t[41]!==P||t[42]!==I||t[43]!==R||t[44]!==z||t[45]!==B?(V=(0,L.jsx)(ee,{id:re,checked:v,disabled:P,"aria-label":I,"aria-describedby":R,onCheckedChange:z,"data-testid":B}),t[39]=v,t[40]=re,t[41]=P,t[42]=I,t[43]=R,t[44]=z,t[45]=B,t[46]=V):V=t[46];let H;t[47]!==N||t[48]!==V||t[49]!==C||t[50]!==w||t[51]!==j||t[52]!==M?(H=(0,L.jsxs)(`div`,{className:C,children:[w,j,M,N,V]}),t[47]=N,t[48]=V,t[49]=C,t[50]=w,t[51]=j,t[52]=M,t[53]=H):H=t[53];let U;t[54]!==H||t[55]!==E||t[56]!==D?(U=(0,L.jsxs)(`div`,{className:E,children:[D,H]}),t[54]=H,t[55]=E,t[56]=D,t[57]=U):U=t[57];let W;t[58]!==n.alias||t[59]!==n.id?(W=(0,L.jsxs)(`span`,{className:`font-mono`,children:[n.id,` · `,n.alias]}),t[58]=n.alias,t[59]=n.id,t[60]=W):W=t[60];let ae=n.docUrl,G,K;t[61]===n.docUrl?(G=t[62],K=t[63]):(G=e=>A(e,n.docUrl),K=e=>A(e,n.docUrl),t[61]=n.docUrl,t[62]=G,t[63]=K);let q;t[64]!==g||t[65]!==n.id?(q=g({id:`iv452l`,values:{0:n.id}}),t[64]=g,t[65]=n.id,t[66]=q):q=t[66];let J,oe;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,L.jsx)(r,{id:`TvY_XA`}),oe=(0,L.jsx)(te,{"aria-hidden":!0,className:`size-3`}),t[67]=J,t[68]=oe):(J=t[67],oe=t[68]);let Y;t[69]!==n.docUrl||t[70]!==G||t[71]!==K||t[72]!==q?(Y=(0,L.jsxs)(`a`,{href:ae,target:`_blank`,rel:`noopener noreferrer`,onClick:G,onAuxClick:K,"aria-label":q,className:`inline-flex items-center gap-0.5 text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[J,oe]}),t[69]=n.docUrl,t[70]=G,t[71]=K,t[72]=q,t[73]=Y):Y=t[73];let X;t[74]!==W||t[75]!==Y?(X=(0,L.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[W,` · `,Y]}),t[74]=W,t[75]=Y,t[76]=X):X=t[76];let Z;if(t[77]!==h||t[78]!==m||t[79]!==n.id||t[80]!==n.options||t[81]!==a){let e;t[83]!==h||t[84]!==m||t[85]!==n.id||t[86]!==a?(e=e=>(0,L.jsx)(ie,{ruleId:n.id,spec:e,value:me(a,e.key),disabled:!m,onChange:t=>h(pe(a,e.key,t))},e.key),t[83]=h,t[84]=m,t[85]=n.id,t[86]=a,t[87]=e):e=t[87],Z=n.options.map(e),t[77]=h,t[78]=m,t[79]=n.id,t[80]=n.options,t[81]=a,t[82]=Z}else Z=t[82];let Q;t[88]!==X||t[89]!==Z?(Q=(0,L.jsx)(u,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:(0,L.jsxs)(`div`,{className:`space-y-3 px-3 pb-3 pt-1`,children:[X,Z]})}),t[88]=X,t[89]=Z,t[90]=Q):Q=t[90];let $;return t[91]!==x||t[92]!==U||t[93]!==Q||t[94]!==O?($=(0,L.jsxs)(x,{"data-testid":O,children:[U,Q]}),t[91]=x,t[92]=U,t[93]=Q,t[94]=O,t[95]=$):$=t[95],$}function Z(e){let t=(0,F.c)(6),{category:n}=e;switch(n){case`Headings`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`PKjGhT`}),t[0]=e):e=t[0],e}case`Lists`:{let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`h16FyT`}),t[1]=e):e=t[1],e}case`Whitespace`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`iIaSUD`}),t[2]=e):e=t[2],e}case`Code`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`EWPtMO`}),t[3]=e):e=t[3],e}case`Links & images`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`-kbIAr`}),t[4]=e):e=t[4],e}case`Style`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`1CalO6`}),t[5]=e):e=t[5],e}default:return n}}function Q(e){return e.toLowerCase().replace(/[^a-z]+/g,`-`).replace(/^-|-$/g,``)}function $(e,t){let n=b(e,t);return n===void 0?e.default??!0:n.value}function se(e,t,n){return t!==null&&b(e,n)!==void 0}function ce(e){return typeof e==`string`?e:null}function le(e,t){let n=t.trim().toLowerCase();return n===``?!0:e.id.toLowerCase().includes(n)||e.alias.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)}function ue(e){return typeof e!=`object`||!e?e!==!1:e.enabled!==!1}function de(e){return typeof e!=`object`||!e?[]:Object.keys(e).filter(e=>e!==`enabled`)}function fe(e,t){if(typeof e!=`object`||!e)return t;let n={};for(let t of Object.keys(e))t!==`enabled`&&(n[t]=e[t]);return Object.keys(n).length===0?t:t?n:{...n,enabled:!1}}function pe(e,t,n){return typeof e==`object`&&e?{...e,[t]:n}:e===!1?{enabled:!1,[t]:n}:{[t]:n}}function me(e,t){if(!(typeof e!=`object`||!e))return e[t]}export{oe as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-Gol9BgNB.js";import{i as s,n as c,t as l}from"./tooltip-B4J7VHmA.js";import{n as u,r as d,t as f}from"./collapsible-B1mS1n9y.js";import{t as p}from"./checkbox-BkZH9Oy1.js";import{t as m}from"./label-DyipnO5I.js";import{a as h,i as g,n as _,o as v,r as y,t as ee}from"./switch-DYic2V-1.js";import{Gn as b,Ot as x,ct as S,er as C}from"./dist-DJbbCXtB.js";import{t as te}from"./arrow-up-right-obRIg3Sv.js";import{t as ne}from"./chevron-right-C8oTR6gu.js";import{t as w}from"./info-yKMseklR.js";import{c as T,r as E}from"./field-BNyAQHKf.js";import{n as D}from"./dist-B8I5m7M1.js";import{t as O}from"./input-D4OPkja2.js";import{t as k}from"./badge-DXHoKHez.js";import{t as A}from"./external-link-Ct0_ujyY.js";import{t as j}from"./skeleton-Mo1oLtEu.js";import{d as M,p as N,r as re}from"./lint-config-client-DJg7YDu3.js";import{t as P}from"./tag-pill-input-BHj4spSb.js";var F=a(),I=e(n(),1),L=t(),R={};function ie(e){let t=(0,F.c)(5),n=R[e.ruleId];if(n!==void 0){let r;return t[0]!==n||t[1]!==e?(r=(0,L.jsx)(n,{...e}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}let r;return t[3]===e?r=t[4]:(r=(0,L.jsx)(z,{...e}),t[3]=e,t[4]=r),r}function z(e){let t=(0,F.c)(65),{ruleId:n,spec:i,value:a,disabled:o,onChange:s}=e,c=`rule-option-${n}-${i.key}`,l=`${c}-description`,u;t[0]!==c||t[1]!==i.key||t[2]!==i.type?(u=i.type===`unsupported`?(0,L.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:i.key}):(0,L.jsx)(m,{htmlFor:c,className:`font-mono text-sm font-medium`,children:i.key}),t[0]=c,t[1]=i.key,t[2]=i.type,t[3]=u):u=t[3];let d;t[4]===i.default?d=t[5]:(d=i.default===void 0?null:(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(r,{id:`KtACeE`,values:{0:H(i.default)},components:{0:(0,L.jsx)(`code`,{className:`font-mono`})}})]}),t[4]=i.default,t[5]=d);let f;t[6]!==l||t[7]!==i.description||t[8]!==d?(f=(0,L.jsxs)(E,{id:l,children:[i.description,d]}),t[6]=l,t[7]=i.description,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==u||t[11]!==f?(p=(0,L.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[u,f]}),t[10]=u,t[11]=f,t[12]=p):p=t[12];let h=p,g=o===!0,_;t[13]!==c||t[14]!==l||t[15]!==s||t[16]!==g?(_={controlId:c,descriptionId:l,disabled:g,onChange:s},t[13]=c,t[14]=l,t[15]=s,t[16]=g,t[17]=_):_=t[17];let v=_;switch(i.type){case`boolean`:{let e;t[18]!==v||t[19]!==i||t[20]!==a?(e=(0,L.jsx)(U,{...v,spec:i,value:a}),t[18]=v,t[19]=i,t[20]=a,t[21]=e):e=t[21];let n;return t[22]!==c||t[23]!==h||t[24]!==e?(n=(0,L.jsx)(B,{testId:c,header:h,children:e}),t[22]=c,t[23]=h,t[24]=e,t[25]=n):n=t[25],n}case`enum`:{let e;t[26]!==v||t[27]!==i||t[28]!==a?(e=(0,L.jsx)(W,{...v,spec:i,value:a}),t[26]=v,t[27]=i,t[28]=a,t[29]=e):e=t[29];let n;return t[30]!==c||t[31]!==h||t[32]!==e?(n=(0,L.jsx)(B,{testId:c,header:h,children:e}),t[30]=c,t[31]=h,t[32]=e,t[33]=n):n=t[33],n}case`integer`:{let e;t[34]!==v||t[35]!==i||t[36]!==a?(e=(0,L.jsx)(G,{...v,spec:i,value:a}),t[34]=v,t[35]=i,t[36]=a,t[37]=e):e=t[37];let n;return t[38]!==c||t[39]!==h||t[40]!==e?(n=(0,L.jsx)(B,{testId:c,header:h,children:e}),t[38]=c,t[39]=h,t[40]=e,t[41]=n):n=t[41],n}case`string`:{let e;t[42]!==v||t[43]!==i||t[44]!==a?(e=(0,L.jsx)(K,{...v,spec:i,value:a}),t[42]=v,t[43]=i,t[44]=a,t[45]=e):e=t[45];let n;return t[46]!==c||t[47]!==h||t[48]!==e?(n=(0,L.jsx)(V,{testId:c,header:h,children:e}),t[46]=c,t[47]=h,t[48]=e,t[49]=n):n=t[49],n}case`string-array`:{let e;t[50]!==v||t[51]!==i||t[52]!==a?(e=(0,L.jsx)(q,{...v,spec:i,value:a}),t[50]=v,t[51]=i,t[52]=a,t[53]=e):e=t[53];let n;return t[54]!==c||t[55]!==h||t[56]!==e?(n=(0,L.jsx)(V,{testId:c,header:h,children:e}),t[54]=c,t[55]=h,t[56]=e,t[57]=n):n=t[57],n}case`unsupported`:{let e=`${c}-unsupported`,n;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,L.jsx)(r,{id:`NQXwDy`}),t[58]=n):n=t[58];let i;t[59]===e?i=t[60]:(i=(0,L.jsx)(k,{variant:`gray`,"data-testid":e,children:n}),t[59]=e,t[60]=i);let a;return t[61]!==c||t[62]!==h||t[63]!==i?(a=(0,L.jsx)(B,{testId:c,header:h,children:i}),t[61]=c,t[62]=h,t[63]=i,t[64]=a):a=t[64],a}default:return i}}function B(e){let t=(0,F.c)(6),{testId:n,header:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,L.jsx)(`div`,{className:`shrink-0`,children:i}),t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==a||t[4]!==n?(o=(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,"data-testid":n,children:[r,a]}),t[2]=r,t[3]=a,t[4]=n,t[5]=o):o=t[5],o}function V(e){let t=(0,F.c)(4),{testId:n,header:r,children:i}=e,a;return t[0]!==i||t[1]!==r||t[2]!==n?(a=(0,L.jsxs)(`div`,{className:`space-y-1.5`,"data-testid":n,children:[r,i]}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function H(e){return JSON.stringify(e)}function U(e){let t=(0,F.c)(8),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c=typeof r==`boolean`?r:n.default??!1,l;t[0]===s?l=t[1]:(l=e=>s(e),t[0]=s,t[1]=l);let u;return t[2]!==c||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==l?(u=(0,L.jsx)(ee,{id:i,checked:c,disabled:o,"aria-describedby":a,onCheckedChange:l}),t[2]=c,t[3]=i,t[4]=a,t[5]=o,t[6]=l,t[7]=u):u=t[7],u}function W(e){let t=(0,F.c)(16),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c=typeof r==`string`?r:n.default??``,l;t[0]===s?l=t[1]:(l=e=>s(e),t[0]=s,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,L.jsx)(v,{}),t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==a?(d=(0,L.jsx)(h,{id:i,"aria-describedby":a,className:`w-48`,children:u}),t[3]=i,t[4]=a,t[5]=d):d=t[5];let f;t[6]===n.enum?f=t[7]:(f=n.enum.map(ae),t[6]=n.enum,t[7]=f);let p;t[8]===f?p=t[9]:(p=(0,L.jsx)(y,{children:f}),t[8]=f,t[9]=p);let m;return t[10]!==c||t[11]!==o||t[12]!==l||t[13]!==d||t[14]!==p?(m=(0,L.jsxs)(_,{value:c,onValueChange:l,disabled:o,children:[d,p]}),t[10]=c,t[11]=o,t[12]=l,t[13]=d,t[14]=p,t[15]=m):m=t[15],m}function ae(e){return(0,L.jsx)(g,{value:e,children:e},e)}function G(e){let t=(0,F.c)(22),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c=typeof r==`number`?r:n.default,l=c===void 0?``:String(c),[u,d]=(0,I.useState)(l),f=(0,I.useRef)(c),p,m;t[0]===c?(p=t[1],m=t[2]):(p=()=>{f.current!==c&&(d(c===void 0?``:String(c)),f.current=c)},m=[c],t[0]=c,t[1]=p,t[2]=m),(0,I.useEffect)(p,m);let h;t[3]!==c||t[4]!==l||t[5]!==s||t[6]!==u||t[7]!==n.maximum||t[8]!==n.minimum?(h=()=>{if(u.trim()===``){d(l);return}let e=Number(u);if(!Number.isFinite(e)){d(l);return}let t=Math.round(e);n.minimum!==void 0&&t<n.minimum&&(t=n.minimum),n.maximum!==void 0&&t>n.maximum&&(t=n.maximum),d(String(t)),t!==c&&s(t)},t[3]=c,t[4]=l,t[5]=s,t[6]=u,t[7]=n.maximum,t[8]=n.minimum,t[9]=h):h=t[9];let g=h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===g?v=t[12]:(v=e=>{e.key===`Enter`&&(e.preventDefault(),g())},t[11]=g,t[12]=v);let y;return t[13]!==g||t[14]!==i||t[15]!==a||t[16]!==o||t[17]!==u||t[18]!==n.maximum||t[19]!==n.minimum||t[20]!==v?(y=(0,L.jsx)(O,{id:i,type:`number`,value:u,min:n.minimum,max:n.maximum,disabled:o,"aria-describedby":a,onChange:_,onBlur:g,onKeyDown:v,className:`h-8 w-28 text-sm tabular-nums`}),t[13]=g,t[14]=i,t[15]=a,t[16]=o,t[17]=u,t[18]=n.maximum,t[19]=n.minimum,t[20]=v,t[21]=y):y=t[21],y}function K(e){let t=(0,F.c)(17),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c=typeof r==`string`?r:n.default??``,[l,u]=(0,I.useState)(c),d=(0,I.useRef)(c),f,p;t[0]===c?(f=t[1],p=t[2]):(f=()=>{d.current!==c&&(u(c),d.current=c)},p=[c],t[0]=c,t[1]=f,t[2]=p),(0,I.useEffect)(f,p);let m;t[3]!==c||t[4]!==s||t[5]!==l?(m=()=>{l!==c&&s(l)},t[3]=c,t[4]=s,t[5]=l,t[6]=m):m=t[6];let h=m,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>u(e.target.value),t[7]=g):g=t[7];let _;t[8]===h?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),h())},t[8]=h,t[9]=_);let v;return t[10]!==h||t[11]!==i||t[12]!==a||t[13]!==o||t[14]!==l||t[15]!==_?(v=(0,L.jsx)(O,{id:i,value:l,disabled:o,"aria-describedby":a,onChange:g,onBlur:h,onKeyDown:_,className:`h-8 font-mono text-sm`}),t[10]=h,t[11]=i,t[12]=a,t[13]=o,t[14]=l,t[15]=_,t[16]=v):v=t[16],v}function q(e){let t=(0,F.c)(11),{spec:n,value:r,controlId:i,descriptionId:a,disabled:o,onChange:s}=e,c;t[0]!==n||t[1]!==r?(c=Array.isArray(r)?r.filter(J):[...n.default??[]],t[0]=n,t[1]=r,t[2]=c):c=t[2];let l=c,u;t[3]===s?u=t[4]:(u=e=>s(e),t[3]=s,t[4]=u);let d;return t[5]!==i||t[6]!==a||t[7]!==o||t[8]!==l||t[9]!==u?(d=(0,L.jsx)(P,{id:i,value:l,grammar:`free-text`,disabled:o,"aria-describedby":a,onChange:u}),t[5]=i,t[6]=a,t[7]=o,t[8]=l,t[9]=u,t[10]=d):d=t[10],d}function J(e){return typeof e==`string`}function oe(e){let t=(0,F.c)(53),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{hideConfigSourceNote:a,initialRuleQuery:o}=n,s=a===void 0?!1:a,{_:c}=i(),{data:l}=M(),h=l!==null,g;t[2]===l?.effective.plugins.markdownlint.rules?g=t[3]:(g=l?.effective.plugins.markdownlint.rules??{},t[2]=l?.effective.plugins.markdownlint.rules,t[3]=g);let _=g,v=l?.configFile??null,[y,ee]=(0,I.useState)(o?.query??``),[C,te]=(0,I.useState)(!1),T=o?.nonce,E=o?.query,k,A;t[4]!==T||t[5]!==E?(k=()=>{T===void 0||E===void 0||ee(E)},A=[T,E],t[4]=T,t[5]=E,t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,I.useEffect)(k,A);let P;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[8]=P):P=t[8];let[R,ie]=(0,I.useState)(P),z;t[9]===c?z=t[10]:(z=function(e,t){N(e,t).then(e=>{if(!e.ok){D.error(e.errorDetail??c({id:`2G-56b`}));return}re()})},t[9]=c,t[10]=z);let B=z,V;t[11]!==C||t[12]!==y?(V=y.trim()!==``||C,t[11]=C,t[12]=y,t[13]=V):V=t[13];let H=V,U;if(t[14]!==c||t[15]!==R||t[16]!==v||t[17]!==H||t[18]!==s||t[19]!==C||t[20]!==h||t[21]!==_||t[22]!==y||t[23]!==B){let e;t[25]!==v||t[26]!==C||t[27]!==_||t[28]!==y?(e=e=>le(e,y)&&(!C||se(_,v,e.id)),t[25]=v,t[26]=C,t[27]=_,t[28]=y,t[29]=e):e=t[29];let n=S.filter(e),i=x.map(e=>({category:e,entries:n.filter(t=>b(t)===e)})).filter(Y),a;t[30]!==v||t[31]!==s||t[32]!==h?(a=!s&&(h?v?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`markdownlint-config-source-note`,children:(0,L.jsx)(r,{id:`V2Gmie`,values:{configFile:v},components:{0:(0,L.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}):(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,L.jsx)(r,{id:`Z6rrjc`,components:{0:(0,L.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}),(0,L.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md border border-dashed p-2.5 text-sm text-muted-foreground`,"data-testid":`markdownlint-no-file-disclaimer`,children:[(0,L.jsx)(w,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0`}),(0,L.jsx)(`span`,{children:(0,L.jsx)(r,{id:`Te6sK2`,components:{0:(0,L.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]})]}):(0,L.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,"data-testid":`markdownlint-rule-browser-config-loading`,children:[(0,L.jsx)(j,{className:`h-4 w-full`}),(0,L.jsx)(j,{className:`h-4 w-2/3`})]})),t[30]=v,t[31]=s,t[32]=h,t[33]=a):a=t[33];let o;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`markdownlint-rule-browser-legend`,children:(0,L.jsx)(r,{id:`zYp8Sr`,components:{0:(0,L.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,L.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})}),t[34]=o):o=t[34];let l;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>ee(e.target.value),t[35]=l):l=t[35];let g;t[36]===c?g=t[37]:(g=c({id:`l-4nnw`}),t[36]=c,t[37]=g);let T;t[38]===c?T=t[39]:(T=c({id:`yf5auF`}),t[38]=c,t[39]=T);let E;t[40]!==y||t[41]!==g||t[42]!==T?(E=(0,L.jsx)(O,{value:y,onChange:l,placeholder:g,"aria-label":T,className:`h-8`,"data-testid":`markdownlint-rule-search`}),t[40]=y,t[41]=g,t[42]=T,t[43]=E):E=t[43];let D;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>te(e===!0),t[44]=D):D=t[44];let k;t[45]===C?k=t[46]:(k=(0,L.jsx)(p,{id:`markdownlint-only-modified`,checked:C,onCheckedChange:D,"data-testid":`markdownlint-only-modified`}),t[45]=C,t[46]=k);let A;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,L.jsx)(m,{htmlFor:`markdownlint-only-modified`,className:`text-sm font-normal`,children:(0,L.jsx)(r,{id:`ccNps_`})}),t[47]=A):A=t[47];let M;t[48]===k?M=t[49]:(M=(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[k,A]}),t[48]=k,t[49]=M);let N;t[50]!==E||t[51]!==M?(N=(0,L.jsxs)(`div`,{className:`flex items-center gap-4`,children:[E,M]}),t[50]=E,t[51]=M,t[52]=N):N=t[52],U=(0,L.jsxs)(`div`,{className:`space-y-3`,"data-testid":`settings-linting-markdownlint-rules`,children:[a,o,N,i.length===0?(0,L.jsx)(`p`,{className:`rounded-md border border-dashed p-3 text-sm text-muted-foreground`,"data-testid":`markdownlint-rule-browser-empty`,children:(0,L.jsx)(r,{id:`RfilGt`})}):(0,L.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>{let{category:t,entries:n}=e,i=n.filter(e=>ue($(_,e.id))).length;return(0,L.jsxs)(f,{open:H||!R.includes(t),onOpenChange:e=>ie(e?R.filter(e=>e!==t):[...R,t]),children:[(0,L.jsxs)(d,{className:`group flex w-full items-center gap-2 rounded-md px-1.5 py-1.5 text-sm font-medium hover:bg-muted/50`,"data-testid":`markdownlint-rule-category-${Q(t)}`,children:[(0,L.jsx)(ne,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),(0,L.jsx)(Z,{category:t}),(0,L.jsx)(`span`,{className:`ms-auto text-xs font-normal text-muted-foreground tabular-nums`,children:(0,L.jsx)(r,{id:`NgZwB0`,values:{0:n.length,enabledCount:i}})})]}),(0,L.jsx)(u,{children:(0,L.jsx)(`div`,{className:`mt-1 divide-y rounded-md border`,children:n.map(e=>(0,L.jsx)(X,{rule:e,value:$(_,e.id),modified:se(_,v,e.id),ready:h,onWrite:t=>B(e.id,t)},e.id))})})]},t)})})]}),t[14]=c,t[15]=R,t[16]=v,t[17]=H,t[18]=s,t[19]=C,t[20]=h,t[21]=_,t[22]=y,t[23]=B,t[24]=U}else U=t[24];return U}function Y(e){return e.entries.length>0}function X(e){let t=(0,F.c)(96),{rule:n,value:a,modified:p,ready:m,onWrite:h}=e,{_:g}=i(),_;t[0]===a?_=t[1]:(_=ue(a),t[0]=a,t[1]=_);let v=_,y;t[2]===a?y=t[3]:(y=ce(a),t[2]=a,t[3]=y);let b=y,x,S,C,w,E,D,O;if(t[4]!==n.id||t[5]!==n.name||t[6]!==a){S=de(a),x=f,O=`markdownlint-rule-row-${n.id}`,E=`flex items-center justify-between gap-3 px-3 py-2`;let e=`markdownlint-rule-expand-${n.id}`,i;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,L.jsx)(ne,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[14]=i):i=t[14];let o;t[15]===n.name?o=t[16]:(o=(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:n.name}),t[15]=n.name,t[16]=o),t[17]!==o||t[18]!==e?(D=(0,L.jsxs)(d,{className:`group flex min-w-0 flex-1 items-center gap-1.5 rounded-md py-0.5 text-left hover:bg-muted/50`,"data-testid":e,children:[i,o]}),t[17]=o,t[18]=e,t[19]=D):D=t[19],C=`flex shrink-0 items-center gap-2`,w=S.length>0?(0,L.jsx)(`span`,{id:`settings-linting-markdownlint-options-${n.id}`,className:`text-xs text-muted-foreground`,title:S.join(`, `),"data-testid":`settings-linting-markdownlint-options-${n.id}`,children:(0,L.jsx)(r,{id:`G-h6qN`,values:{0:S.length}})}):null,t[4]=n.id,t[5]=n.name,t[6]=a,t[7]=x,t[8]=S,t[9]=C,t[10]=w,t[11]=E,t[12]=D,t[13]=O}else x=t[7],S=t[8],C=t[9],w=t[10],E=t[11],D=t[12],O=t[13];let j;t[20]!==n.id||t[21]!==b?(j=b===null?null:(0,L.jsx)(k,{variant:`gray`,"data-testid":`markdownlint-rule-severity-${n.id}`,children:b}),t[20]=n.id,t[21]=b,t[22]=j):j=t[22];let M;t[23]!==p||t[24]!==n.id?(M=p?(0,L.jsx)(k,{variant:`outline`,"data-testid":`markdownlint-rule-modified-${n.id}`,children:(0,L.jsx)(r,{id:`tgWuMB`})}):null,t[23]=p,t[24]=n.id,t[25]=M):M=t[25];let N;t[26]!==g||t[27]!==p||t[28]!==h||t[29]!==m||t[30]!==n.id?(N=p?(0,L.jsxs)(l,{children:[(0,L.jsx)(s,{asChild:!0,children:(0,L.jsx)(o,{variant:`ghost`,size:`icon`,className:`h-5 w-5 shrink-0 text-muted-foreground opacity-60 hover:opacity-100`,disabled:!m,"aria-label":g({id:`50ORFs`,values:{0:n.id}}),onClick:()=>h(null),children:(0,L.jsx)(T,{className:`size-3.5`})})}),(0,L.jsx)(c,{children:(0,L.jsx)(r,{id:`L-rMC9`})})]}):null,t[26]=g,t[27]=p,t[28]=h,t[29]=m,t[30]=n.id,t[31]=N):N=t[31];let re=`markdownlint-rule-toggle-${n.id}`,P=!m,I;t[32]!==g||t[33]!==v||t[34]!==n.name?(I=g(v?{id:`y5UgU8`,values:{0:n.name}}:{id:`FZtBeR`,values:{0:n.name}}),t[32]=g,t[33]=v,t[34]=n.name,t[35]=I):I=t[35];let R=S.length>0?`settings-linting-markdownlint-options-${n.id}`:void 0,z;t[36]!==h||t[37]!==a?(z=e=>h(fe(a,e)),t[36]=h,t[37]=a,t[38]=z):z=t[38];let B=`markdownlint-rule-toggle-${n.id}`,V;t[39]!==v||t[40]!==re||t[41]!==P||t[42]!==I||t[43]!==R||t[44]!==z||t[45]!==B?(V=(0,L.jsx)(ee,{id:re,checked:v,disabled:P,"aria-label":I,"aria-describedby":R,onCheckedChange:z,"data-testid":B}),t[39]=v,t[40]=re,t[41]=P,t[42]=I,t[43]=R,t[44]=z,t[45]=B,t[46]=V):V=t[46];let H;t[47]!==N||t[48]!==V||t[49]!==C||t[50]!==w||t[51]!==j||t[52]!==M?(H=(0,L.jsxs)(`div`,{className:C,children:[w,j,M,N,V]}),t[47]=N,t[48]=V,t[49]=C,t[50]=w,t[51]=j,t[52]=M,t[53]=H):H=t[53];let U;t[54]!==H||t[55]!==E||t[56]!==D?(U=(0,L.jsxs)(`div`,{className:E,children:[D,H]}),t[54]=H,t[55]=E,t[56]=D,t[57]=U):U=t[57];let W;t[58]!==n.alias||t[59]!==n.id?(W=(0,L.jsxs)(`span`,{className:`font-mono`,children:[n.id,` · `,n.alias]}),t[58]=n.alias,t[59]=n.id,t[60]=W):W=t[60];let ae=n.docUrl,G,K;t[61]===n.docUrl?(G=t[62],K=t[63]):(G=e=>A(e,n.docUrl),K=e=>A(e,n.docUrl),t[61]=n.docUrl,t[62]=G,t[63]=K);let q;t[64]!==g||t[65]!==n.id?(q=g({id:`iv452l`,values:{0:n.id}}),t[64]=g,t[65]=n.id,t[66]=q):q=t[66];let J,oe;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,L.jsx)(r,{id:`TvY_XA`}),oe=(0,L.jsx)(te,{"aria-hidden":!0,className:`size-3`}),t[67]=J,t[68]=oe):(J=t[67],oe=t[68]);let Y;t[69]!==n.docUrl||t[70]!==G||t[71]!==K||t[72]!==q?(Y=(0,L.jsxs)(`a`,{href:ae,target:`_blank`,rel:`noopener noreferrer`,onClick:G,onAuxClick:K,"aria-label":q,className:`inline-flex items-center gap-0.5 text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[J,oe]}),t[69]=n.docUrl,t[70]=G,t[71]=K,t[72]=q,t[73]=Y):Y=t[73];let X;t[74]!==W||t[75]!==Y?(X=(0,L.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[W,` · `,Y]}),t[74]=W,t[75]=Y,t[76]=X):X=t[76];let Z;if(t[77]!==h||t[78]!==m||t[79]!==n.id||t[80]!==n.options||t[81]!==a){let e;t[83]!==h||t[84]!==m||t[85]!==n.id||t[86]!==a?(e=e=>(0,L.jsx)(ie,{ruleId:n.id,spec:e,value:me(a,e.key),disabled:!m,onChange:t=>h(pe(a,e.key,t))},e.key),t[83]=h,t[84]=m,t[85]=n.id,t[86]=a,t[87]=e):e=t[87],Z=n.options.map(e),t[77]=h,t[78]=m,t[79]=n.id,t[80]=n.options,t[81]=a,t[82]=Z}else Z=t[82];let Q;t[88]!==X||t[89]!==Z?(Q=(0,L.jsx)(u,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:(0,L.jsxs)(`div`,{className:`space-y-3 px-3 pb-3 pt-1`,children:[X,Z]})}),t[88]=X,t[89]=Z,t[90]=Q):Q=t[90];let $;return t[91]!==x||t[92]!==U||t[93]!==Q||t[94]!==O?($=(0,L.jsxs)(x,{"data-testid":O,children:[U,Q]}),t[91]=x,t[92]=U,t[93]=Q,t[94]=O,t[95]=$):$=t[95],$}function Z(e){let t=(0,F.c)(6),{category:n}=e;switch(n){case`Headings`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`PKjGhT`}),t[0]=e):e=t[0],e}case`Lists`:{let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`h16FyT`}),t[1]=e):e=t[1],e}case`Whitespace`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`iIaSUD`}),t[2]=e):e=t[2],e}case`Code`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`EWPtMO`}),t[3]=e):e=t[3],e}case`Links & images`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`-kbIAr`}),t[4]=e):e=t[4],e}case`Style`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(r,{id:`1CalO6`}),t[5]=e):e=t[5],e}default:return n}}function Q(e){return e.toLowerCase().replace(/[^a-z]+/g,`-`).replace(/^-|-$/g,``)}function $(e,t){let n=C(e,t);return n===void 0?e.default??!0:n.value}function se(e,t,n){return t!==null&&C(e,n)!==void 0}function ce(e){return typeof e==`string`?e:null}function le(e,t){let n=t.trim().toLowerCase();return n===``?!0:e.id.toLowerCase().includes(n)||e.alias.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)}function ue(e){return typeof e!=`object`||!e?e!==!1:e.enabled!==!1}function de(e){return typeof e!=`object`||!e?[]:Object.keys(e).filter(e=>e!==`enabled`)}function fe(e,t){if(typeof e!=`object`||!e)return t;let n={};for(let t of Object.keys(e))t!==`enabled`&&(n[t]=e[t]);return Object.keys(n).length===0?t:t?n:{...n,enabled:!1}}function pe(e,t,n){return typeof e==`object`&&e?{...e,[t]:n}:e===!1?{enabled:!1,[t]:n}:{[t]:n}}function me(e,t){if(!(typeof e!=`object`||!e))return e[t]}export{oe as t};
@@ -1 +1 @@
1
- import{$a as e,Cr as t,Rr as n,Yr as r,j as i,kr as a,qr as o,ro as s,ti as c,xi as l}from"./dist-Cv2LF2DL.js";import{o as u,r as d}from"./file-tree-utils-Cy6smqXE.js";import{v as f}from"./doc-hash-unBeSU8C.js";var p=null,m=new Set;function h(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function g(e,t){return e===null?!1:e===t?!0:h(e.pages,t.pages)&&h(e.folderPaths,t.folderPaths)&&h(e.assetPaths??new Set,t.assetPaths??new Set)&&h(e.filePaths??new Set,t.filePaths??new Set)&&_(e.pageIcons,t.pageIcons)}function _(e,t){if(e===t)return!0;let n=e?.size??0;if(n!==(t?.size??0))return!1;if(n===0)return!0;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function v(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function y(e,t){let n=new Map,r=[...e].sort((e,t)=>e.localeCompare(t));for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function b(e){let t=new Map;for(let[n,r]of e){let e=r.icon;typeof e==`string`&&e.trim()!==``&&t.set(n,e)}return t}function x(){return p}function S(e){if(!g(p,e)){p=e;for(let t of Array.from(m))try{t(e)}catch(e){console.error(`[page-list-cache] subscriber threw:`,e)}}}function C(e){if(m.add(e),p!==null)try{e(p)}catch(e){console.error(`[page-list-cache] subscriber threw on replay:`,e)}return()=>{m.delete(e)}}function w(e){let t=e.trim();return{normalizedTarget:t.replace(/^\.\/+/,``).replace(/^\/+/,``).replace(/\/+$/g,``),expectsFolder:/\/+$/.test(t)}}function T(e){return f(e).replace(/\/+$/g,``)}function E(e){let t=new Set;for(let n of e)for(let e of d(n))t.add(e);return t}function D(e,t){if(!t)return;let n=l(e);if(n)return t.get(n)}function O(e,t){if(!t||e.includes(`/`))return;let n=l(e);if(n)return t.get(n)}function k(e,t){return t?`${e}${t}`:(e.split(`/`).pop()??``).lastIndexOf(`.`)>0?e:`${e}.md`}function A(e,t){if(!u(e))return null;let r=n(e);if(r)return{kind:`doc`,target:r,docName:r};if(t.pages.has(e))return null;let i=k(e,t.docExt);return{kind:`asset`,target:i,assetPath:i,mediaKind:s(i.slice(i.lastIndexOf(`.`)+1))}}function j(t,i){if(a(t)){let e=o(t);if(e?.kind===`reference`){let t=`references/${e.rel}.md`;return{kind:`skill-file`,target:`global/${e.name}/${t}`,scope:`global`,name:e.name,path:t}}let n=r(t);if(n?.kind===`skill`&&n.scope===`project`){let e=c(n.name);return{kind:`doc`,target:e,docName:e}}return{kind:`doc`,target:t,docName:t}}let s=n(t);if(s)return{kind:`doc`,target:s,docName:s};let{normalizedTarget:l,expectsFolder:u}=w(t);if(!l)return{kind:`missing`,target:l};if(!u&&e(l))return{kind:`doc`,target:l,docName:l};let d=T(t);if(!u&&i.pages.has(l))return{kind:`doc`,target:l,docName:l};if(!u&&d!==l&&i.pages.has(d))return{kind:`doc`,target:d,docName:d};if(!u){let e=D(d,i.pagesBySlug);if(e)return{kind:`doc`,target:e,docName:e}}let f=`${d}/index`;if(i.pages.has(f))return{kind:`folder-index`,target:d,folderPath:d,docName:f,noteKind:`canonical-index`};let p=d.split(`/`).pop(),m=p?`${d}/${p}`:null;if(m&&i.pages.has(m))return{kind:`folder-index`,target:d,folderPath:d,docName:m,noteKind:`legacy-folder-note`};if(!u){let e=O(d,i.pagesByBasename);if(e)return{kind:`doc`,target:e,docName:e}}return(i.folderPaths??E(i.pages)).has(d)?{kind:`folder`,target:d,folderPath:d}:A(l,i)??{kind:`missing`,target:d||l}}function M(e){return e.kind===`folder-index`?{kind:`folder`,target:e.folderPath,folderPath:e.folderPath}:e}function N(e,n,r=i){return typeof n!=`number`||!t(n,r)?null:{kind:`large-file`,target:e,docName:e,size:n,limit:r}}function P(e,t,n=i){return e.kind!==`doc`&&e.kind!==`folder-index`?e:N(e.docName,t.get(e.docName)?.size,n)??e}function F(e){switch(e.kind){case`doc`:case`folder-index`:case`large-file`:return e.docName;case`missing`:return e.target;case`asset`:case`skill-file`:case`folder`:return null}}export{A as a,b as c,x as d,S as f,N as i,y as l,F as n,j as o,C as p,M as r,P as s,E as t,v as u};
1
+ import{$a as e,Ar as t,Jr as n,Xr as r,j as i,ro as a,ti as o,wr as s,xi as c,zr as l}from"./dist-DJbbCXtB.js";import{o as u,r as d}from"./file-tree-utils-Lc0SvgnU.js";import{v as f}from"./doc-hash-BbU2eA08.js";var p=null,m=new Set;function h(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function g(e,t){return e===null?!1:e===t?!0:h(e.pages,t.pages)&&h(e.folderPaths,t.folderPaths)&&h(e.assetPaths??new Set,t.assetPaths??new Set)&&h(e.filePaths??new Set,t.filePaths??new Set)&&_(e.pageIcons,t.pageIcons)}function _(e,t){if(e===t)return!0;let n=e?.size??0;if(n!==(t?.size??0))return!1;if(n===0)return!0;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function v(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function y(e,t){let n=new Map,r=[...e].sort((e,t)=>e.localeCompare(t));for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function b(e){let t=new Map;for(let[n,r]of e){let e=r.icon;typeof e==`string`&&e.trim()!==``&&t.set(n,e)}return t}function x(){return p}function S(e){if(!g(p,e)){p=e;for(let t of Array.from(m))try{t(e)}catch(e){console.error(`[page-list-cache] subscriber threw:`,e)}}}function C(e){if(m.add(e),p!==null)try{e(p)}catch(e){console.error(`[page-list-cache] subscriber threw on replay:`,e)}return()=>{m.delete(e)}}function w(e){let t=e.trim();return{normalizedTarget:t.replace(/^\.\/+/,``).replace(/^\/+/,``).replace(/\/+$/g,``),expectsFolder:/\/+$/.test(t)}}function T(e){return f(e).replace(/\/+$/g,``)}function E(e){let t=new Set;for(let n of e)for(let e of d(n))t.add(e);return t}function D(e,t){if(!t)return;let n=c(e);if(n)return t.get(n)}function O(e,t){if(!t||e.includes(`/`))return;let n=c(e);if(n)return t.get(n)}function k(e,t){return t?`${e}${t}`:(e.split(`/`).pop()??``).lastIndexOf(`.`)>0?e:`${e}.md`}function A(e,t){if(!u(e))return null;let n=l(e);if(n)return{kind:`doc`,target:n,docName:n};if(t.pages.has(e))return null;let r=k(e,t.docExt);return{kind:`asset`,target:r,assetPath:r,mediaKind:a(r.slice(r.lastIndexOf(`.`)+1))}}function j(i,a){if(t(i)){let e=n(i);if(e?.kind===`reference`){let t=`references/${e.rel}.md`;return{kind:`skill-file`,target:`global/${e.name}/${t}`,scope:`global`,name:e.name,path:t}}let t=r(i);if(t?.kind===`skill`&&t.scope===`project`){let e=o(t.name);return{kind:`doc`,target:e,docName:e}}return{kind:`doc`,target:i,docName:i}}let s=l(i);if(s)return{kind:`doc`,target:s,docName:s};let{normalizedTarget:c,expectsFolder:u}=w(i);if(!c)return{kind:`missing`,target:c};if(!u&&e(c))return{kind:`doc`,target:c,docName:c};let d=T(i);if(!u&&a.pages.has(c))return{kind:`doc`,target:c,docName:c};if(!u&&d!==c&&a.pages.has(d))return{kind:`doc`,target:d,docName:d};if(!u){let e=D(d,a.pagesBySlug);if(e)return{kind:`doc`,target:e,docName:e}}let f=`${d}/index`;if(a.pages.has(f))return{kind:`folder-index`,target:d,folderPath:d,docName:f,noteKind:`canonical-index`};let p=d.split(`/`).pop(),m=p?`${d}/${p}`:null;if(m&&a.pages.has(m))return{kind:`folder-index`,target:d,folderPath:d,docName:m,noteKind:`legacy-folder-note`};if(!u){let e=O(d,a.pagesByBasename);if(e)return{kind:`doc`,target:e,docName:e}}return(a.folderPaths??E(a.pages)).has(d)?{kind:`folder`,target:d,folderPath:d}:A(c,a)??{kind:`missing`,target:d||c}}function M(e){return e.kind===`folder-index`?{kind:`folder`,target:e.folderPath,folderPath:e.folderPath}:e}function N(e,t,n=i){return typeof t!=`number`||!s(t,n)?null:{kind:`large-file`,target:e,docName:e,size:t,limit:n}}function P(e,t,n=i){return e.kind!==`doc`&&e.kind!==`folder-index`?e:N(e.docName,t.get(e.docName)?.size,n)??e}function F(e){switch(e.kind){case`doc`:case`folder-index`:case`large-file`:return e.docName;case`missing`:return e.target;case`asset`:case`skill-file`:case`folder`:return null}}export{A as a,b as c,x as d,S as f,N as i,y as l,F as n,j as o,C as p,M as r,P as s,E as t,v as u};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-DAkhoPjT.js";import{t}from"./parse-api-error-BtEL2kxi.js";import{a as n}from"./documents-events-DJXnk07Z.js";import{l as r,s as i}from"./doc-hash-unBeSU8C.js";var a=e(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);async function o(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function s(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await o(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function c(e){try{let t=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await o(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(e,t){try{let r=`?folder=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,i=await fetch(`/api/template${r}`,{method:`DELETE`});if(!i.ok)return{ok:!1,error:await o(i)};let a=await i.json().catch(()=>null);return n(),{ok:!0,existed:a?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function u(e){try{let t=await fetch(`/api/template`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await o(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,committed:r?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function d(e){try{let t=await fetch(`/api/template/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await o(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,path:r?.path??``,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function f(e){if(typeof window>`u`)return;let t=i(e);window.location.hash!==t&&(window.location.hash=t)}function p(e){if(typeof window>`u`)return;let t=r(e);window.location.hash!==t&&(window.location.hash=t)}export{u as a,a as c,d as i,p as n,s as o,l as r,c as s,f as t};
1
+ import{t as e}from"./createLucideIcon-DAkhoPjT.js";import{t}from"./parse-api-error-BtEL2kxi.js";import{a as n}from"./documents-events-C-mYs64z.js";import{l as r,s as i}from"./doc-hash-BbU2eA08.js";var a=e(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);async function o(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function s(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await o(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function c(e){try{let t=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await o(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(e,t){try{let r=`?folder=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,i=await fetch(`/api/template${r}`,{method:`DELETE`});if(!i.ok)return{ok:!1,error:await o(i)};let a=await i.json().catch(()=>null);return n(),{ok:!0,existed:a?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function u(e){try{let t=await fetch(`/api/template`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await o(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,committed:r?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function d(e){try{let t=await fetch(`/api/template/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await o(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,path:r?.path??``,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function f(e){if(typeof window>`u`)return;let t=i(e);window.location.hash!==t&&(window.location.hash=t)}function p(e){if(typeof window>`u`)return;let t=r(e);window.location.hash!==t&&(window.location.hash=t)}export{u as a,a as c,d as i,p as n,s as o,l as r,c as s,f as t};
@@ -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"./createLucideIcon-DAkhoPjT.js";import{t as s}from"./button-Gol9BgNB.js";import{c,d as l,i as u,n as d,o as f,p,s as m,t as h}from"./EnableSyncConfirmDialog-GUnrwfa0.js";import{t as g}from"./arrow-up-right-obRIg3Sv.js";import{t as _}from"./check-GqWaoTdV.js";import{t as v}from"./folder-open-wLd69QUc.js";import{t as y}from"./info-yKMseklR.js";import{t as b}from"./loader-circle-Cg5SU7AZ.js";import{n as x}from"./miss-dialog-store-Bx4JLuKB.js";import{t as S}from"./refresh-cw-DClG_qgN.js";import{t as C}from"./triangle-alert-Bcc1P5yx.js";import{n as w}from"./dist-B8I5m7M1.js";import{r as T,u as E,v as D}from"./doc-hash-unBeSU8C.js";import{t as O}from"./external-link-Ct0_ujyY.js";var k=o(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),A=o(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),j=o(`file-x-corner`,[[`path`,{d:`M11 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5`,key:`1jo35a`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m15 17 5 5`,key:`36xl1x`}],[`path`,{d:`m20 17-5 5`,key:`vdz27y`}]]),M=a(),N=e(n(),1),P=t(),F=`https://git-scm.com/docs/git-push`;function I(e,t){return e===`empty`?!0:!(e!==`stale`&&e!==`absent`||e===`stale`&&t?.syncEnabled===!0)}function L(e){return e?e.state!==`dormant`&&e.state!==`disabled`&&e.state!==`auth-error`&&e.state!==`conflict`:!1}function R(e){let t=(0,M.c)(52),{freshness:n,status:a,kind:o}=e,{_:c}=i(),{confirmOpen:l,setConfirmOpen:p,onToggleRequest:m,onConfirm:v}=u(f()),[b,x]=(0,N.useState)(`idle`),w=(0,N.useRef)(null),T,E;if(t[0]!==a||t[1]!==b?(T=()=>{if(!(b!==`pending`||!a)){if(a.pushError||a.pushErrorCode){x(`idle`);return}(a.lastSyncUtc??null)!==w.current&&x(`synced`)}},E=[b,a],t[0]=a,t[1]=b,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,N.useEffect)(T,E),!I(n,a))return null;if(n===`empty`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(C,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[4]=e):e=t[4];let n;t[5]===c?n=t[6]:(n=c({id:`eazHgv`}),t[5]=c,t[6]=n);let r;return t[7]===n?r=t[8]:(r=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[e,(0,P.jsx)(`span`,{children:n})]}),t[7]=n,t[8]=r),r}if(b===`synced`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[(0,P.jsx)(_,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:(0,P.jsx)(r,{id:`fxbCNQ`})})]}),t[9]=e):e=t[9],e}let D=a?.syncEnabled===!0,O=a?.pushPermission?.checkStatus===`denied`,k=!!(a?.pushError||a?.pushErrorCode),A=O||k,j=n===`absent`&&!D,R;if(n===`absent`&&!D){let e;t[10]!==c||t[11]!==o?(e=c(o===`folder`?{id:`PrJYSN`}:{id:`3BnyYc`}),t[10]=c,t[11]=o,t[12]=e):e=t[12],R=e}else if(n===`stale`){let e;t[13]!==c||t[14]!==o?(e=c(o===`folder`?{id:`Gt4gOO`}:{id:`2IYGkU`}),t[13]=c,t[14]=o,t[15]=e):e=t[15],R=e}else{let e;t[16]!==c||t[17]!==o?(e=c(o===`folder`?{id:`nqV0Kk`}:{id:`gwykHF`}),t[16]=c,t[17]=o,t[18]=e):e=t[18],R=e}let V;t[19]!==c||t[20]!==k||t[21]!==O?(V=O?c({id:`9OIqw4`}):k?c({id:`K6MQQk`}):null,t[19]=c,t[20]=k,t[21]=O,t[22]=V):V=t[22];let H=V,U;t[23]===a?.lastSyncUtc?U=t[24]:(U=()=>{w.current=a?.lastSyncUtc??null,x(`pending`),d(`sync`).catch(e=>{console.warn(`[share-freshness] sync trigger failed`,e instanceof Error?e.message:e),x(`idle`)})},t[23]=a?.lastSyncUtc,t[24]=U);let W=U,G=j?C:y,K;t[25]===G?K=t[26]:(K=(0,P.jsx)(G,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[25]=G,t[26]=K);let q;t[27]===R?q=t[28]:(q=(0,P.jsx)(`span`,{children:R}),t[27]=R,t[28]=q);let J;t[29]===H?J=t[30]:(J=H?(0,P.jsx)(`span`,{children:H}):null,t[29]=H,t[30]=J);let Y;t[31]!==A||t[32]!==W||t[33]!==m||t[34]!==a||t[35]!==D||t[36]!==b?(Y=A?null:D?L(a)?(0,P.jsx)(`div`,{children:b===`pending`?(0,P.jsxs)(s,{variant:`outline`,size:`xs`,disabled:!0,children:[(0,P.jsx)(S,{className:`size-3 shrink-0 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`EHu0x2`})]}):(0,P.jsx)(s,{variant:`outline`,size:`xs`,onClick:W,children:(0,P.jsx)(r,{id:`lb_UU4`})})}):null:(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,P.jsx)(s,{variant:`outline`,size:`xs`,onClick:()=>m(!0),children:(0,P.jsx)(r,{id:`XU0OXn`})}),(0,P.jsxs)(`a`,{href:F,target:`_blank`,rel:`noopener noreferrer`,onClick:B,onAuxClick:z,className:`inline-flex items-center gap-1 transition-colors hover:text-primary`,children:[(0,P.jsx)(r,{id:`GLxIKR`}),(0,P.jsx)(g,{className:`size-3 shrink-0`,"aria-hidden":`true`})]})]}),t[31]=A,t[32]=W,t[33]=m,t[34]=a,t[35]=D,t[36]=b,t[37]=Y):Y=t[37];let X;t[38]!==q||t[39]!==J||t[40]!==Y?(X=(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[q,J,Y]}),t[38]=q,t[39]=J,t[40]=Y,t[41]=X):X=t[41];let Z;t[42]!==K||t[43]!==X?(Z=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[K,X]}),t[42]=K,t[43]=X,t[44]=Z):Z=t[44];let Q;t[45]!==l||t[46]!==v||t[47]!==p?(Q=(0,P.jsx)(h,{open:l,onOpenChange:p,onConfirm:v}),t[45]=l,t[46]=v,t[47]=p,t[48]=Q):Q=t[48];let $;return t[49]!==Z||t[50]!==Q?($=(0,P.jsxs)(P.Fragment,{children:[Z,Q]}),t[49]=Z,t[50]=Q,t[51]=$):$=t[51],$}function z(e){return O(e,F)}function B(e){return O(e,F)}function V(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function H(e){let t=(0,M.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={phase:`pending`},t[0]=n):n=t[0];let[r,i]=(0,N.useState)(n),[a,o]=(0,N.useState)(0),s=e.branch,c;t[1]!==s||t[2]!==e.kind||t[3]!==e.path?(c=()=>{let t=window.okDesktop??null;if(!t||s===null){i({phase:`resolved`,resolution:{verdict:`unknown`}});return}let n=!1;return t.project.fetchTargetStatus({projectPath:t.config.projectPath,branch:s,path:e.path,kind:e.kind}).then(e=>{n||i({phase:`resolved`,resolution:e??{verdict:`unknown`}})}).catch(e=>{n||(console.warn(`[receive] miss target-status fetch failed`,e instanceof Error?e.message:e),i({phase:`resolved`,resolution:{verdict:`unknown`}}))}),()=>{n=!0}},t[1]=s,t[2]=e.kind,t[3]=e.path,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==a||t[7]!==e.kind||t[8]!==e.path?(l=[s,e.kind,e.path,a],t[5]=s,t[6]=a,t[7]=e.kind,t[8]=e.path,t[9]=l):l=t[9],(0,N.useEffect)(c,l);let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{i({phase:`pending`}),o(U)},t[10]=u):u=t[10];let d;return t[11]===r?d=t[12]:(d={state:r,refetch:u},t[11]=r,t[12]=d),d}function U(e){return e+1}function W(e){let t=(0,M.c)(15),{onEnabled:n}=e,i=f(),a;t[0]===n?a=t[1]:(a={onEnabled:n},t[0]=n,t[1]=a);let{confirmOpen:o,setConfirmOpen:c,onToggleRequest:l,onConfirm:d}=u(i,a),p;t[2]===l?p=t[3]:(p=()=>l(!0),t[2]=l,t[3]=p);let m,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,P.jsx)(S,{className:`size-4`,"aria-hidden":`true`}),g=(0,P.jsx)(r,{id:`XU0OXn`}),t[4]=m,t[5]=g):(m=t[4],g=t[5]);let _;t[6]===p?_=t[7]:(_=(0,P.jsxs)(s,{onClick:p,"data-testid":`share-receive-miss-enable-sync`,children:[m,g]}),t[6]=p,t[7]=_);let v;t[8]!==o||t[9]!==d||t[10]!==c?(v=(0,P.jsx)(h,{open:o,onOpenChange:c,onConfirm:d}),t[8]=o,t[9]=d,t[10]=c,t[11]=v):v=t[11];let y;return t[12]!==_||t[13]!==v?(y=(0,P.jsxs)(P.Fragment,{children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14],y}function G(e){let t=(0,M.c)(23),{status:n,onSyncCompleted:a}=e,{_:o}=i(),[c,l]=(0,N.useState)(!1),u=(0,N.useRef)(null),f;t[0]!==a||t[1]!==c||t[2]!==n.lastSyncUtc||t[3]!==n.pushError||t[4]!==n.pushErrorCode?(f=()=>{if(c){if(n.pushError||n.pushErrorCode){l(!1);return}(n.lastSyncUtc??null)!==u.current&&(l(!1),a?.())}},t[0]=a,t[1]=c,t[2]=n.lastSyncUtc,t[3]=n.pushError,t[4]=n.pushErrorCode,t[5]=f):f=t[5];let p;t[6]!==a||t[7]!==c||t[8]!==n?(p=[c,n,a],t[6]=a,t[7]=c,t[8]=n,t[9]=p):p=t[9],(0,N.useEffect)(f,p);let m;t[10]!==o||t[11]!==n.lastSyncUtc?(m=()=>{u.current=n.lastSyncUtc??null,l(!0),d(`sync`).catch(e=>{console.warn(`[receive] miss sync trigger failed`,e instanceof Error?e.message:e),l(!1),w.error(o({id:`1u-mAI`}))})},t[10]=o,t[11]=n.lastSyncUtc,t[12]=m):m=t[12];let h=m,g;t[13]!==h||t[14]!==c?(g=c?(0,P.jsxs)(s,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-sync-now`,children:[(0,P.jsx)(S,{className:`size-4 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`EHu0x2`})]}):(0,P.jsxs)(s,{onClick:h,"data-testid":`share-receive-miss-sync-now`,children:[(0,P.jsx)(S,{className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`lb_UU4`})]}),t[13]=h,t[14]=c,t[15]=g):g=t[15];let _;t[16]===c?_=t[17]:(_=c?(0,P.jsx)(r,{id:`dXOolp`}):null,t[16]=c,t[17]=_);let v;t[18]===_?v=t[19]:(v=(0,P.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-sync-status`,children:_}),t[18]=_,t[19]=v);let y;return t[20]!==g||t[21]!==v?(y=(0,P.jsxs)(P.Fragment,{children:[g,v]}),t[20]=g,t[21]=v,t[22]=y):y=t[22],y}var K=!1;function q(e){return!K&&e!==null&&e.syncEnabled!==!0}function J(e){return e===null?!1:e.hasRemote&&e.lastPullUtc!==void 0&&e.state!==`conflict`}function Y(e,t){let n=(0,M.c)(15),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(!1),l=(0,N.useRef)(null),u,f;n[0]!==t||n[1]!==r||n[2]!==e?(u=()=>{if(!r||(e?.lastPullUtc??null)===l.current)return;i(!1);let n=e?.lastPullOutcome??null;if(n===null){t?.();return}switch(n){case`refused`:case`error`:o(n);return;case`succeeded`:case`up-to-date`:if(q(e)){K=!0,c(!0);return}t?.();return;case`conflict`:t?.();return;default:t?.();return}},f=[r,e,t],n[0]=t,n[1]=r,n[2]=e,n[3]=u,n[4]=f):(u=n[3],f=n[4]),(0,N.useEffect)(u,f);let p;n[5]===t?p=n[6]:(p=()=>{c(!1),t?.()},n[5]=t,n[6]=p);let m;n[7]===e?.lastPullUtc?m=n[8]:(m=()=>{l.current=e?.lastPullUtc??null,o(null),i(!0),d(`pull`).catch(e=>{console.warn(`[receive] miss pull trigger failed`,e instanceof Error?e.message:e),i(!1),o(`error`)})},n[7]=e?.lastPullUtc,n[8]=m);let h;return n[9]!==a||n[10]!==s||n[11]!==r||n[12]!==p||n[13]!==m?(h={pending:r,failure:a,offering:s,resolveOffer:p,start:m},n[9]=a,n[10]=s,n[11]=r,n[12]=p,n[13]=m,n[14]=h):h=n[14],h}function X(e){let t=(0,M.c)(10),{pending:n,onPull:i}=e,a;t[0]!==i||t[1]!==n?(a=n?(0,P.jsxs)(s,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-pull-now`,children:[(0,P.jsx)(S,{className:`size-4 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`4uNLmk`})]}):(0,P.jsxs)(s,{onClick:i,"data-testid":`share-receive-miss-pull-now`,children:[(0,P.jsx)(p,{className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`fevEu0`})]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o=n?(0,P.jsx)(r,{id:`glG1TR`}):null,t[3]=n,t[4]=o);let c;t[5]===o?c=t[6]:(c=(0,P.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-pull-status`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,P.jsxs)(P.Fragment,{children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Z(e){let t=(0,M.c)(18),{onResolve:n,strandedCommitCount:r}=e,i=c(),a=(0,N.useRef)(!1),o;t[0]===n?o=t[1]:(o=function(){a.current||(a.current=!0,n())},t[0]=n,t[1]=o);let s=o,l;t[2]===s?l=t[3]:(l={onApplied:s},t[2]=s,t[3]=l);let{confirmOpen:u,setConfirmOpen:d,onModeSelect:f,onConfirm:p}=m(i,`off`,l),g=(0,N.useRef)(!1),_,v;t[4]===f?(_=t[5],v=t[6]):(_=()=>{g.current||(g.current=!0,f(`follow`))},v=[f],t[4]=f,t[5]=_,t[6]=v),(0,N.useEffect)(_,v);let y;t[7]!==s||t[8]!==d?(y=e=>{d(e),e||s()},t[7]=s,t[8]=d,t[9]=y):y=t[9];let b;t[10]!==p||t[11]!==s?(b=()=>{p(),s()},t[10]=p,t[11]=s,t[12]=b):b=t[12];let x;return t[13]!==u||t[14]!==r||t[15]!==y||t[16]!==b?(x=(0,P.jsx)(h,{open:u,onOpenChange:y,onConfirm:b,variant:`follow`,strandedCommitCount:r}),t[13]=u,t[14]=r,t[15]=y,t[16]=b,t[17]=x):x=t[17],x}function Q(e){let t=(0,M.c)(89),{nav:n,state:a,onBrowseFolder:o,onOpenRenamed:c,onEnableAutoSync:u,onSyncCompleted:d,onPullApplied:f}=e,{_:m}=i(),h=l(),g=Y(h,f),_=n.branch,y;t[0]!==m||t[1]!==n.kind?(y=n.kind===`folder`?m({id:`ugoTXs`}):m({id:`XH30C4`}),t[0]=m,t[1]=n.kind,t[2]=y):y=t[2];let S=y;if(a.phase===`pending`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(b,{className:`size-5 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`c8jBgX`})]}),t[3]=e):e=t[3],e}let{resolution:C}=a,w,T;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,P.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),T=(0,P.jsx)(r,{id:`hItdtk`}),t[4]=w,t[5]=T):(w=t[4],T=t[5]);let E;t[6]===o?E=t[7]:(E=(0,P.jsxs)(s,{variant:`outline`,onClick:o,"data-testid":`share-receive-miss-browse`,children:[w,T]}),t[6]=o,t[7]=E);let D=E,O,N,F,I=null;if(C.verdict===`renamed`){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(x,{className:`size-9`,"aria-hidden":`true`}),t[8]=e):e=t[8],O=e;let n;t[9]!==C.renamedTo||t[10]!==S?(n={0:C.renamedTo,targetNoun:S},t[9]=C.renamedTo,t[10]=S,t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[12]=i):i=t[12];let a;t[13]===n?a=t[14]:(a=(0,P.jsx)(r,{id:`P0HC30`,values:n,components:i}),t[13]=n,t[14]=a),N=a;let o;t[15]!==c||t[16]!==C.renamedTo?(o=()=>c(C.renamedTo),t[15]=c,t[16]=C.renamedTo,t[17]=o):o=t[17];let l,u;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,P.jsx)(x,{className:`size-4`,"aria-hidden":`true`}),u=(0,P.jsx)(r,{id:`AItsE5`}),t[18]=l,t[19]=u):(l=t[18],u=t[19]);let d;t[20]===o?d=t[21]:(d=(0,P.jsxs)(s,{onClick:o,"data-testid":`share-receive-miss-open-renamed`,children:[l,u]}),t[20]=o,t[21]=d);let f;t[22]!==D||t[23]!==d?(f=(0,P.jsxs)(P.Fragment,{children:[d,D]}),t[22]=D,t[23]=d,t[24]=f):f=t[24],F=f}else if(C.verdict===`deleted`){let e;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(j,{className:`size-9`,"aria-hidden":`true`}),t[25]=e):e=t[25],O=e;let n;t[26]!==_||t[27]!==S?(n={targetNoun:S,branch:_},t[26]=_,t[27]=S,t[28]=n):n=t[28];let i;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[29]=i):i=t[29];let a;t[30]===n?a=t[31]:(a=(0,P.jsx)(r,{id:`kpqWwG`,values:n,components:i}),t[30]=n,t[31]=a),N=a,F=D}else if(C.verdict===`never-on-branch`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(A,{className:`size-9`,"aria-hidden":`true`}),t[32]=e):e=t[32],O=e;let n;t[33]!==_||t[34]!==S?(n={targetNoun:S,branch:_},t[33]=_,t[34]=S,t[35]=n):n=t[35];let i;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[36]=i):i=t[36];let a;t[37]===n?a=t[38]:(a=(0,P.jsx)(r,{id:`i9TPUi`,values:n,components:i}),t[37]=n,t[38]=a),N=a,F=D}else if(C.verdict===`changed-locally`){let e;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(k,{className:`size-9`,"aria-hidden":`true`}),t[39]=e):e=t[39],O=e;let n=h?.syncEnabled===!0,i=h?.pushPermission?.checkStatus===`denied`||!!(h?.pushError||h?.pushErrorCode);if(n){let e;t[40]!==_||t[41]!==S?(e=_===null?(0,P.jsx)(r,{id:`RyIKxy`,values:{targetNoun:S}}):(0,P.jsx)(r,{id:`l6kpzR`,values:{targetNoun:S,branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[40]=_,t[41]=S,t[42]=e):e=t[42],N=e}else{let e;t[43]!==_||t[44]!==S?(e=_===null?(0,P.jsx)(r,{id:`UuYo7g`,values:{targetNoun:S}}):(0,P.jsx)(r,{id:`HoWElC`,values:{targetNoun:S,branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[43]=_,t[44]=S,t[45]=e):e=t[45],N=e}let a=null;if(h?.syncEnabled){if(L(h)&&!i){let e;t[46]!==d||t[47]!==h?(e=(0,P.jsx)(G,{status:h,onSyncCompleted:d}),t[46]=d,t[47]=h,t[48]=e):e=t[48],a=e}}else if(h!==null){let e;t[49]===u?e=t[50]:(e=(0,P.jsx)(W,{onEnabled:u}),t[49]=u,t[50]=e),a=e}let o;t[51]!==D||t[52]!==a?(o=(0,P.jsxs)(P.Fragment,{children:[a,D]}),t[51]=D,t[52]=a,t[53]=o):o=t[53],F=o}else{let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(p,{className:`size-9`,"aria-hidden":`true`}),t[54]=e):e=t[54],O=e;let n;t[55]===h?n=t[56]:(n=J(h),t[55]=h,t[56]=n);let i=n;if(i){let e;t[57]===_?e=t[58]:(e=_===null?(0,P.jsx)(r,{id:`gwEcOD`}):(0,P.jsx)(r,{id:`wvK7Ay`,values:{branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[57]=_,t[58]=e),N=e}else{let e;t[59]===_?e=t[60]:(e=_===null?(0,P.jsx)(r,{id:`Xewl6B`}):(0,P.jsx)(r,{id:`d1JjXo`,values:{branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[59]=_,t[60]=e),N=e}let a=g.failure===null?`sr-only`:`max-w-md text-balance text-1sm text-destructive`,o;t[61]===g.failure?o=t[62]:(o=g.failure===`refused`?(0,P.jsx)(r,{id:`Xp7Kq4`}):g.failure===`error`?(0,P.jsx)(r,{id:`JG_8KT`}):null,t[61]=g.failure,t[62]=o);let s;t[63]!==a||t[64]!==o?(s=(0,P.jsx)(`p`,{role:`alert`,className:a,"data-testid":`share-receive-miss-pull-error`,children:o}),t[63]=a,t[64]=o,t[65]=s):s=t[65],I=s;let c;t[66]!==i||t[67]!==g.pending||t[68]!==g.start?(c=i?(0,P.jsx)(X,{pending:g.pending,onPull:g.start}):null,t[66]=i,t[67]=g.pending,t[68]=g.start,t[69]=c):c=t[69];let l;t[70]!==g.offering||t[71]!==g.resolveOffer||t[72]!==h?.ahead?(l=g.offering?(0,P.jsx)(Z,{onResolve:g.resolveOffer,strandedCommitCount:h?.ahead??0}):null,t[70]=g.offering,t[71]=g.resolveOffer,t[72]=h?.ahead,t[73]=l):l=t[73];let u;t[74]!==D||t[75]!==c||t[76]!==l?(u=(0,P.jsxs)(P.Fragment,{children:[c,D,l]}),t[74]=D,t[75]=c,t[76]=l,t[77]=u):u=t[77],F=u}let R;t[78]===O?R=t[79]:(R=(0,P.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:O}),t[78]=O,t[79]=R);let z;t[80]===N?z=t[81]:(z=(0,P.jsx)(`p`,{className:`max-w-md text-balance text-base leading-6 text-foreground/90`,children:N}),t[80]=N,t[81]=z);let B;t[82]===F?B=t[83]:(B=(0,P.jsx)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-center`,children:F}),t[82]=F,t[83]=B);let V;return t[84]!==I||t[85]!==R||t[86]!==z||t[87]!==B?(V=(0,P.jsxs)(P.Fragment,{children:[R,z,I,B]}),t[84]=I,t[85]=R,t[86]=z,t[87]=B,t[88]=V):V=t[88],V}function $(e){return e.replace(/^\/+|\/+$/g,``)}function ee(e,t){if(t.kind===`folder`){if(E(e))return $(t.path)===``;let n=T(e);return n!==null&&$(n)===$(t.path)}let n=T(e);return n===null?!1:D(n)===D(t.path)}function te(){let e=null,t=new Set,n=!1;function r(){for(let e of t)e()}function i(t){e!==t&&(e=t,r())}function a(){e!==null&&(ee(window.location.hash,e)||i(null))}function o(){n||typeof window>`u`||(n=!0,window.addEventListener(`hashchange`,a))}return{arm(e){o(),i(e)},clear(){i(null)},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dispose(){n&&typeof window<`u`&&(window.removeEventListener(`hashchange`,a),n=!1),i(null)}}}var ne=te();function re(e,t){return e===null||e.kind!==`missing`||t===null||D(t.path)!==e.target?null:t}export{H as a,V as i,ne as n,R as o,Q as r,I as s,re as t};
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"./createLucideIcon-DAkhoPjT.js";import{t as s}from"./button-Gol9BgNB.js";import{c,d as l,i as u,n as d,o as f,p,s as m,t as h}from"./EnableSyncConfirmDialog-Dufpw3Xm.js";import{t as g}from"./arrow-up-right-obRIg3Sv.js";import{t as _}from"./check-GqWaoTdV.js";import{t as v}from"./folder-open-wLd69QUc.js";import{t as y}from"./info-yKMseklR.js";import{t as b}from"./loader-circle-Cg5SU7AZ.js";import{n as x}from"./miss-dialog-store-Bx4JLuKB.js";import{t as S}from"./refresh-cw-DClG_qgN.js";import{t as C}from"./triangle-alert-Bcc1P5yx.js";import{n as w}from"./dist-B8I5m7M1.js";import{r as T,u as E,v as D}from"./doc-hash-BbU2eA08.js";import{t as O}from"./external-link-Ct0_ujyY.js";var k=o(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),A=o(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),j=o(`file-x-corner`,[[`path`,{d:`M11 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5`,key:`1jo35a`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m15 17 5 5`,key:`36xl1x`}],[`path`,{d:`m20 17-5 5`,key:`vdz27y`}]]),M=a(),N=e(n(),1),P=t(),F=`https://git-scm.com/docs/git-push`;function I(e,t){return e===`empty`?!0:!(e!==`stale`&&e!==`absent`||e===`stale`&&t?.syncEnabled===!0)}function L(e){return e?e.state!==`dormant`&&e.state!==`disabled`&&e.state!==`auth-error`&&e.state!==`conflict`:!1}function R(e){let t=(0,M.c)(52),{freshness:n,status:a,kind:o}=e,{_:c}=i(),{confirmOpen:l,setConfirmOpen:p,onToggleRequest:m,onConfirm:v}=u(f()),[b,x]=(0,N.useState)(`idle`),w=(0,N.useRef)(null),T,E;if(t[0]!==a||t[1]!==b?(T=()=>{if(!(b!==`pending`||!a)){if(a.pushError||a.pushErrorCode){x(`idle`);return}(a.lastSyncUtc??null)!==w.current&&x(`synced`)}},E=[b,a],t[0]=a,t[1]=b,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,N.useEffect)(T,E),!I(n,a))return null;if(n===`empty`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(C,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[4]=e):e=t[4];let n;t[5]===c?n=t[6]:(n=c({id:`eazHgv`}),t[5]=c,t[6]=n);let r;return t[7]===n?r=t[8]:(r=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[e,(0,P.jsx)(`span`,{children:n})]}),t[7]=n,t[8]=r),r}if(b===`synced`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[(0,P.jsx)(_,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:(0,P.jsx)(r,{id:`fxbCNQ`})})]}),t[9]=e):e=t[9],e}let D=a?.syncEnabled===!0,O=a?.pushPermission?.checkStatus===`denied`,k=!!(a?.pushError||a?.pushErrorCode),A=O||k,j=n===`absent`&&!D,R;if(n===`absent`&&!D){let e;t[10]!==c||t[11]!==o?(e=c(o===`folder`?{id:`PrJYSN`}:{id:`3BnyYc`}),t[10]=c,t[11]=o,t[12]=e):e=t[12],R=e}else if(n===`stale`){let e;t[13]!==c||t[14]!==o?(e=c(o===`folder`?{id:`Gt4gOO`}:{id:`2IYGkU`}),t[13]=c,t[14]=o,t[15]=e):e=t[15],R=e}else{let e;t[16]!==c||t[17]!==o?(e=c(o===`folder`?{id:`nqV0Kk`}:{id:`gwykHF`}),t[16]=c,t[17]=o,t[18]=e):e=t[18],R=e}let V;t[19]!==c||t[20]!==k||t[21]!==O?(V=O?c({id:`9OIqw4`}):k?c({id:`K6MQQk`}):null,t[19]=c,t[20]=k,t[21]=O,t[22]=V):V=t[22];let H=V,U;t[23]===a?.lastSyncUtc?U=t[24]:(U=()=>{w.current=a?.lastSyncUtc??null,x(`pending`),d(`sync`).catch(e=>{console.warn(`[share-freshness] sync trigger failed`,e instanceof Error?e.message:e),x(`idle`)})},t[23]=a?.lastSyncUtc,t[24]=U);let W=U,G=j?C:y,K;t[25]===G?K=t[26]:(K=(0,P.jsx)(G,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[25]=G,t[26]=K);let q;t[27]===R?q=t[28]:(q=(0,P.jsx)(`span`,{children:R}),t[27]=R,t[28]=q);let J;t[29]===H?J=t[30]:(J=H?(0,P.jsx)(`span`,{children:H}):null,t[29]=H,t[30]=J);let Y;t[31]!==A||t[32]!==W||t[33]!==m||t[34]!==a||t[35]!==D||t[36]!==b?(Y=A?null:D?L(a)?(0,P.jsx)(`div`,{children:b===`pending`?(0,P.jsxs)(s,{variant:`outline`,size:`xs`,disabled:!0,children:[(0,P.jsx)(S,{className:`size-3 shrink-0 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`EHu0x2`})]}):(0,P.jsx)(s,{variant:`outline`,size:`xs`,onClick:W,children:(0,P.jsx)(r,{id:`lb_UU4`})})}):null:(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,P.jsx)(s,{variant:`outline`,size:`xs`,onClick:()=>m(!0),children:(0,P.jsx)(r,{id:`XU0OXn`})}),(0,P.jsxs)(`a`,{href:F,target:`_blank`,rel:`noopener noreferrer`,onClick:B,onAuxClick:z,className:`inline-flex items-center gap-1 transition-colors hover:text-primary`,children:[(0,P.jsx)(r,{id:`GLxIKR`}),(0,P.jsx)(g,{className:`size-3 shrink-0`,"aria-hidden":`true`})]})]}),t[31]=A,t[32]=W,t[33]=m,t[34]=a,t[35]=D,t[36]=b,t[37]=Y):Y=t[37];let X;t[38]!==q||t[39]!==J||t[40]!==Y?(X=(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[q,J,Y]}),t[38]=q,t[39]=J,t[40]=Y,t[41]=X):X=t[41];let Z;t[42]!==K||t[43]!==X?(Z=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[K,X]}),t[42]=K,t[43]=X,t[44]=Z):Z=t[44];let Q;t[45]!==l||t[46]!==v||t[47]!==p?(Q=(0,P.jsx)(h,{open:l,onOpenChange:p,onConfirm:v}),t[45]=l,t[46]=v,t[47]=p,t[48]=Q):Q=t[48];let $;return t[49]!==Z||t[50]!==Q?($=(0,P.jsxs)(P.Fragment,{children:[Z,Q]}),t[49]=Z,t[50]=Q,t[51]=$):$=t[51],$}function z(e){return O(e,F)}function B(e){return O(e,F)}function V(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function H(e){let t=(0,M.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={phase:`pending`},t[0]=n):n=t[0];let[r,i]=(0,N.useState)(n),[a,o]=(0,N.useState)(0),s=e.branch,c;t[1]!==s||t[2]!==e.kind||t[3]!==e.path?(c=()=>{let t=window.okDesktop??null;if(!t||s===null){i({phase:`resolved`,resolution:{verdict:`unknown`}});return}let n=!1;return t.project.fetchTargetStatus({projectPath:t.config.projectPath,branch:s,path:e.path,kind:e.kind}).then(e=>{n||i({phase:`resolved`,resolution:e??{verdict:`unknown`}})}).catch(e=>{n||(console.warn(`[receive] miss target-status fetch failed`,e instanceof Error?e.message:e),i({phase:`resolved`,resolution:{verdict:`unknown`}}))}),()=>{n=!0}},t[1]=s,t[2]=e.kind,t[3]=e.path,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==a||t[7]!==e.kind||t[8]!==e.path?(l=[s,e.kind,e.path,a],t[5]=s,t[6]=a,t[7]=e.kind,t[8]=e.path,t[9]=l):l=t[9],(0,N.useEffect)(c,l);let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{i({phase:`pending`}),o(U)},t[10]=u):u=t[10];let d;return t[11]===r?d=t[12]:(d={state:r,refetch:u},t[11]=r,t[12]=d),d}function U(e){return e+1}function W(e){let t=(0,M.c)(15),{onEnabled:n}=e,i=f(),a;t[0]===n?a=t[1]:(a={onEnabled:n},t[0]=n,t[1]=a);let{confirmOpen:o,setConfirmOpen:c,onToggleRequest:l,onConfirm:d}=u(i,a),p;t[2]===l?p=t[3]:(p=()=>l(!0),t[2]=l,t[3]=p);let m,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,P.jsx)(S,{className:`size-4`,"aria-hidden":`true`}),g=(0,P.jsx)(r,{id:`XU0OXn`}),t[4]=m,t[5]=g):(m=t[4],g=t[5]);let _;t[6]===p?_=t[7]:(_=(0,P.jsxs)(s,{onClick:p,"data-testid":`share-receive-miss-enable-sync`,children:[m,g]}),t[6]=p,t[7]=_);let v;t[8]!==o||t[9]!==d||t[10]!==c?(v=(0,P.jsx)(h,{open:o,onOpenChange:c,onConfirm:d}),t[8]=o,t[9]=d,t[10]=c,t[11]=v):v=t[11];let y;return t[12]!==_||t[13]!==v?(y=(0,P.jsxs)(P.Fragment,{children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14],y}function G(e){let t=(0,M.c)(23),{status:n,onSyncCompleted:a}=e,{_:o}=i(),[c,l]=(0,N.useState)(!1),u=(0,N.useRef)(null),f;t[0]!==a||t[1]!==c||t[2]!==n.lastSyncUtc||t[3]!==n.pushError||t[4]!==n.pushErrorCode?(f=()=>{if(c){if(n.pushError||n.pushErrorCode){l(!1);return}(n.lastSyncUtc??null)!==u.current&&(l(!1),a?.())}},t[0]=a,t[1]=c,t[2]=n.lastSyncUtc,t[3]=n.pushError,t[4]=n.pushErrorCode,t[5]=f):f=t[5];let p;t[6]!==a||t[7]!==c||t[8]!==n?(p=[c,n,a],t[6]=a,t[7]=c,t[8]=n,t[9]=p):p=t[9],(0,N.useEffect)(f,p);let m;t[10]!==o||t[11]!==n.lastSyncUtc?(m=()=>{u.current=n.lastSyncUtc??null,l(!0),d(`sync`).catch(e=>{console.warn(`[receive] miss sync trigger failed`,e instanceof Error?e.message:e),l(!1),w.error(o({id:`1u-mAI`}))})},t[10]=o,t[11]=n.lastSyncUtc,t[12]=m):m=t[12];let h=m,g;t[13]!==h||t[14]!==c?(g=c?(0,P.jsxs)(s,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-sync-now`,children:[(0,P.jsx)(S,{className:`size-4 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`EHu0x2`})]}):(0,P.jsxs)(s,{onClick:h,"data-testid":`share-receive-miss-sync-now`,children:[(0,P.jsx)(S,{className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`lb_UU4`})]}),t[13]=h,t[14]=c,t[15]=g):g=t[15];let _;t[16]===c?_=t[17]:(_=c?(0,P.jsx)(r,{id:`dXOolp`}):null,t[16]=c,t[17]=_);let v;t[18]===_?v=t[19]:(v=(0,P.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-sync-status`,children:_}),t[18]=_,t[19]=v);let y;return t[20]!==g||t[21]!==v?(y=(0,P.jsxs)(P.Fragment,{children:[g,v]}),t[20]=g,t[21]=v,t[22]=y):y=t[22],y}var K=!1;function q(e){return!K&&e!==null&&e.syncEnabled!==!0}function J(e){return e===null?!1:e.hasRemote&&e.lastPullUtc!==void 0&&e.state!==`conflict`}function Y(e,t){let n=(0,M.c)(15),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(!1),l=(0,N.useRef)(null),u,f;n[0]!==t||n[1]!==r||n[2]!==e?(u=()=>{if(!r||(e?.lastPullUtc??null)===l.current)return;i(!1);let n=e?.lastPullOutcome??null;if(n===null){t?.();return}switch(n){case`refused`:case`error`:o(n);return;case`succeeded`:case`up-to-date`:if(q(e)){K=!0,c(!0);return}t?.();return;case`conflict`:t?.();return;default:t?.();return}},f=[r,e,t],n[0]=t,n[1]=r,n[2]=e,n[3]=u,n[4]=f):(u=n[3],f=n[4]),(0,N.useEffect)(u,f);let p;n[5]===t?p=n[6]:(p=()=>{c(!1),t?.()},n[5]=t,n[6]=p);let m;n[7]===e?.lastPullUtc?m=n[8]:(m=()=>{l.current=e?.lastPullUtc??null,o(null),i(!0),d(`pull`).catch(e=>{console.warn(`[receive] miss pull trigger failed`,e instanceof Error?e.message:e),i(!1),o(`error`)})},n[7]=e?.lastPullUtc,n[8]=m);let h;return n[9]!==a||n[10]!==s||n[11]!==r||n[12]!==p||n[13]!==m?(h={pending:r,failure:a,offering:s,resolveOffer:p,start:m},n[9]=a,n[10]=s,n[11]=r,n[12]=p,n[13]=m,n[14]=h):h=n[14],h}function X(e){let t=(0,M.c)(10),{pending:n,onPull:i}=e,a;t[0]!==i||t[1]!==n?(a=n?(0,P.jsxs)(s,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-pull-now`,children:[(0,P.jsx)(S,{className:`size-4 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`4uNLmk`})]}):(0,P.jsxs)(s,{onClick:i,"data-testid":`share-receive-miss-pull-now`,children:[(0,P.jsx)(p,{className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`fevEu0`})]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o=n?(0,P.jsx)(r,{id:`glG1TR`}):null,t[3]=n,t[4]=o);let c;t[5]===o?c=t[6]:(c=(0,P.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-pull-status`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,P.jsxs)(P.Fragment,{children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Z(e){let t=(0,M.c)(18),{onResolve:n,strandedCommitCount:r}=e,i=c(),a=(0,N.useRef)(!1),o;t[0]===n?o=t[1]:(o=function(){a.current||(a.current=!0,n())},t[0]=n,t[1]=o);let s=o,l;t[2]===s?l=t[3]:(l={onApplied:s},t[2]=s,t[3]=l);let{confirmOpen:u,setConfirmOpen:d,onModeSelect:f,onConfirm:p}=m(i,`off`,l),g=(0,N.useRef)(!1),_,v;t[4]===f?(_=t[5],v=t[6]):(_=()=>{g.current||(g.current=!0,f(`follow`))},v=[f],t[4]=f,t[5]=_,t[6]=v),(0,N.useEffect)(_,v);let y;t[7]!==s||t[8]!==d?(y=e=>{d(e),e||s()},t[7]=s,t[8]=d,t[9]=y):y=t[9];let b;t[10]!==p||t[11]!==s?(b=()=>{p(),s()},t[10]=p,t[11]=s,t[12]=b):b=t[12];let x;return t[13]!==u||t[14]!==r||t[15]!==y||t[16]!==b?(x=(0,P.jsx)(h,{open:u,onOpenChange:y,onConfirm:b,variant:`follow`,strandedCommitCount:r}),t[13]=u,t[14]=r,t[15]=y,t[16]=b,t[17]=x):x=t[17],x}function Q(e){let t=(0,M.c)(89),{nav:n,state:a,onBrowseFolder:o,onOpenRenamed:c,onEnableAutoSync:u,onSyncCompleted:d,onPullApplied:f}=e,{_:m}=i(),h=l(),g=Y(h,f),_=n.branch,y;t[0]!==m||t[1]!==n.kind?(y=n.kind===`folder`?m({id:`ugoTXs`}):m({id:`XH30C4`}),t[0]=m,t[1]=n.kind,t[2]=y):y=t[2];let S=y;if(a.phase===`pending`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(b,{className:`size-5 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`c8jBgX`})]}),t[3]=e):e=t[3],e}let{resolution:C}=a,w,T;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,P.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),T=(0,P.jsx)(r,{id:`hItdtk`}),t[4]=w,t[5]=T):(w=t[4],T=t[5]);let E;t[6]===o?E=t[7]:(E=(0,P.jsxs)(s,{variant:`outline`,onClick:o,"data-testid":`share-receive-miss-browse`,children:[w,T]}),t[6]=o,t[7]=E);let D=E,O,N,F,I=null;if(C.verdict===`renamed`){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(x,{className:`size-9`,"aria-hidden":`true`}),t[8]=e):e=t[8],O=e;let n;t[9]!==C.renamedTo||t[10]!==S?(n={0:C.renamedTo,targetNoun:S},t[9]=C.renamedTo,t[10]=S,t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[12]=i):i=t[12];let a;t[13]===n?a=t[14]:(a=(0,P.jsx)(r,{id:`P0HC30`,values:n,components:i}),t[13]=n,t[14]=a),N=a;let o;t[15]!==c||t[16]!==C.renamedTo?(o=()=>c(C.renamedTo),t[15]=c,t[16]=C.renamedTo,t[17]=o):o=t[17];let l,u;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,P.jsx)(x,{className:`size-4`,"aria-hidden":`true`}),u=(0,P.jsx)(r,{id:`AItsE5`}),t[18]=l,t[19]=u):(l=t[18],u=t[19]);let d;t[20]===o?d=t[21]:(d=(0,P.jsxs)(s,{onClick:o,"data-testid":`share-receive-miss-open-renamed`,children:[l,u]}),t[20]=o,t[21]=d);let f;t[22]!==D||t[23]!==d?(f=(0,P.jsxs)(P.Fragment,{children:[d,D]}),t[22]=D,t[23]=d,t[24]=f):f=t[24],F=f}else if(C.verdict===`deleted`){let e;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(j,{className:`size-9`,"aria-hidden":`true`}),t[25]=e):e=t[25],O=e;let n;t[26]!==_||t[27]!==S?(n={targetNoun:S,branch:_},t[26]=_,t[27]=S,t[28]=n):n=t[28];let i;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[29]=i):i=t[29];let a;t[30]===n?a=t[31]:(a=(0,P.jsx)(r,{id:`kpqWwG`,values:n,components:i}),t[30]=n,t[31]=a),N=a,F=D}else if(C.verdict===`never-on-branch`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(A,{className:`size-9`,"aria-hidden":`true`}),t[32]=e):e=t[32],O=e;let n;t[33]!==_||t[34]!==S?(n={targetNoun:S,branch:_},t[33]=_,t[34]=S,t[35]=n):n=t[35];let i;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[36]=i):i=t[36];let a;t[37]===n?a=t[38]:(a=(0,P.jsx)(r,{id:`i9TPUi`,values:n,components:i}),t[37]=n,t[38]=a),N=a,F=D}else if(C.verdict===`changed-locally`){let e;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(k,{className:`size-9`,"aria-hidden":`true`}),t[39]=e):e=t[39],O=e;let n=h?.syncEnabled===!0,i=h?.pushPermission?.checkStatus===`denied`||!!(h?.pushError||h?.pushErrorCode);if(n){let e;t[40]!==_||t[41]!==S?(e=_===null?(0,P.jsx)(r,{id:`RyIKxy`,values:{targetNoun:S}}):(0,P.jsx)(r,{id:`l6kpzR`,values:{targetNoun:S,branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[40]=_,t[41]=S,t[42]=e):e=t[42],N=e}else{let e;t[43]!==_||t[44]!==S?(e=_===null?(0,P.jsx)(r,{id:`UuYo7g`,values:{targetNoun:S}}):(0,P.jsx)(r,{id:`HoWElC`,values:{targetNoun:S,branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[43]=_,t[44]=S,t[45]=e):e=t[45],N=e}let a=null;if(h?.syncEnabled){if(L(h)&&!i){let e;t[46]!==d||t[47]!==h?(e=(0,P.jsx)(G,{status:h,onSyncCompleted:d}),t[46]=d,t[47]=h,t[48]=e):e=t[48],a=e}}else if(h!==null){let e;t[49]===u?e=t[50]:(e=(0,P.jsx)(W,{onEnabled:u}),t[49]=u,t[50]=e),a=e}let o;t[51]!==D||t[52]!==a?(o=(0,P.jsxs)(P.Fragment,{children:[a,D]}),t[51]=D,t[52]=a,t[53]=o):o=t[53],F=o}else{let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(p,{className:`size-9`,"aria-hidden":`true`}),t[54]=e):e=t[54],O=e;let n;t[55]===h?n=t[56]:(n=J(h),t[55]=h,t[56]=n);let i=n;if(i){let e;t[57]===_?e=t[58]:(e=_===null?(0,P.jsx)(r,{id:`gwEcOD`}):(0,P.jsx)(r,{id:`wvK7Ay`,values:{branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[57]=_,t[58]=e),N=e}else{let e;t[59]===_?e=t[60]:(e=_===null?(0,P.jsx)(r,{id:`Xewl6B`}):(0,P.jsx)(r,{id:`d1JjXo`,values:{branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[59]=_,t[60]=e),N=e}let a=g.failure===null?`sr-only`:`max-w-md text-balance text-1sm text-destructive`,o;t[61]===g.failure?o=t[62]:(o=g.failure===`refused`?(0,P.jsx)(r,{id:`Xp7Kq4`}):g.failure===`error`?(0,P.jsx)(r,{id:`JG_8KT`}):null,t[61]=g.failure,t[62]=o);let s;t[63]!==a||t[64]!==o?(s=(0,P.jsx)(`p`,{role:`alert`,className:a,"data-testid":`share-receive-miss-pull-error`,children:o}),t[63]=a,t[64]=o,t[65]=s):s=t[65],I=s;let c;t[66]!==i||t[67]!==g.pending||t[68]!==g.start?(c=i?(0,P.jsx)(X,{pending:g.pending,onPull:g.start}):null,t[66]=i,t[67]=g.pending,t[68]=g.start,t[69]=c):c=t[69];let l;t[70]!==g.offering||t[71]!==g.resolveOffer||t[72]!==h?.ahead?(l=g.offering?(0,P.jsx)(Z,{onResolve:g.resolveOffer,strandedCommitCount:h?.ahead??0}):null,t[70]=g.offering,t[71]=g.resolveOffer,t[72]=h?.ahead,t[73]=l):l=t[73];let u;t[74]!==D||t[75]!==c||t[76]!==l?(u=(0,P.jsxs)(P.Fragment,{children:[c,D,l]}),t[74]=D,t[75]=c,t[76]=l,t[77]=u):u=t[77],F=u}let R;t[78]===O?R=t[79]:(R=(0,P.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:O}),t[78]=O,t[79]=R);let z;t[80]===N?z=t[81]:(z=(0,P.jsx)(`p`,{className:`max-w-md text-balance text-base leading-6 text-foreground/90`,children:N}),t[80]=N,t[81]=z);let B;t[82]===F?B=t[83]:(B=(0,P.jsx)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-center`,children:F}),t[82]=F,t[83]=B);let V;return t[84]!==I||t[85]!==R||t[86]!==z||t[87]!==B?(V=(0,P.jsxs)(P.Fragment,{children:[R,z,I,B]}),t[84]=I,t[85]=R,t[86]=z,t[87]=B,t[88]=V):V=t[88],V}function $(e){return e.replace(/^\/+|\/+$/g,``)}function ee(e,t){if(t.kind===`folder`){if(E(e))return $(t.path)===``;let n=T(e);return n!==null&&$(n)===$(t.path)}let n=T(e);return n===null?!1:D(n)===D(t.path)}function te(){let e=null,t=new Set,n=!1;function r(){for(let e of t)e()}function i(t){e!==t&&(e=t,r())}function a(){e!==null&&(ee(window.location.hash,e)||i(null))}function o(){n||typeof window>`u`||(n=!0,window.addEventListener(`hashchange`,a))}return{arm(e){o(),i(e)},clear(){i(null)},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dispose(){n&&typeof window<`u`&&(window.removeEventListener(`hashchange`,a),n=!1),i(null)}}}var ne=te();function re(e,t){return e===null||e.kind!==`missing`||t===null||D(t.path)!==e.target?null:t}export{H as a,V as i,ne as n,R as o,Q as r,I as s,re as t};
@@ -1 +1 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./createLucideIcon-DAkhoPjT.js";import{xi as o}from"./dist-Cv2LF2DL.js";import{t as s}from"./parse-api-error-BtEL2kxi.js";import{c as ee,f as te,l as c,t as ne,u as l}from"./navigation-targets-CRrgSRY3.js";import{c as re}from"./documents-events-DJXnk07Z.js";import{t as u}from"./documents-fetch-Db-Ikele.js";import{r as ie}from"./startup-marks-CyxDWRgR.js";var d=a(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),f=a(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),p=e(r(),1),ae=i();function m(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var oe=n(),h=(0,p.createContext)(null);function se(e,t){if(t.size===0)return new Set(e);let n=new Set(e);for(let e of t)n.add(e);return n}function ce(e,t){if(e.size===0)return new Set;let n=new Set;for(let r of e)t.has(r)||n.add(r);return n}function g(e,t){let n=new Map(e);for(let e of t)n.has(e)||n.set(e,e);return n}async function le(){let e=await fetch(`/api/pages`);if(!e.ok){let t=await e.json().catch(()=>null);throw Error(s(t)??`/api/pages responded with ${e.status}`)}let t=await e.json();return Array.isArray(t.pages)?t.pages:[]}async function ue(){let{ok:e,status:t,body:n}=await u();if(!e)throw Error(s(n)??`/api/documents responded with ${t}`);let r=n??{};return Array.isArray(r.documents)?{assetPaths:r.documents.filter(e=>e.kind===`asset`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path),folderPaths:r.documents.filter(e=>e.kind===`folder`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path),filePaths:r.documents.filter(e=>e.kind===`file`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path)}:{assetPaths:[],folderPaths:[],filePaths:[]}}function de(e){console.error(`[PageListContext] Failed to load pages:`,e)}function _(e){console.warn(`[PageListContext] Failed to load referenced assets:`,e)}function v(e){let t=(0,ae.c)(54),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,t[0]=r):r=t[0];let[i,a]=(0,p.useState)(r),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=new Map,t[1]=s):s=t[1];let[u,d]=(0,p.useState)(s),f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Map,t[2]=f):f=t[2];let[_,v]=(0,p.useState)(f),y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=new Set,t[3]=y):y=t[3];let[b,x]=(0,p.useState)(y),S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=new Set,t[4]=S):S=t[4];let[C,ge]=(0,p.useState)(S),w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=new Set,t[5]=w):w=t[5];let[T,_e]=(0,p.useState)(w),E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=new Set,t[6]=E):E=t[6];let[D,O]=(0,p.useState)(E),[k,A]=(0,p.useState)(!0),[j,M]=(0,p.useState)(null),N=(0,p.useRef)(0),P;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(){let e=N.current+=1;return Promise.all([le(),ue().catch(he)]).then(t=>{let[n,r]=t;if(e!==N.current)return;let i=new Set(n.map(me));a(i),d(new Map(n.map(pe))),v(new Map(n.map(fe))),x(new Set(r.assetPaths)),ge(new Set(r.folderPaths)),_e(new Set(r.filePaths)),O(e=>ce(e,i)),M(null),ie()}).catch(t=>{e===N.current&&(de(t),M(t instanceof Error?t.message:`Failed to load pages`))}).finally(()=>{e===N.current&&A(!1)})},t[7]=P):P=t[7];let F=P,I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){O(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n}),M(null)},t[8]=I):I=t[8];let ve=I,L,R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=m(F);e.request();let t=null,n=()=>{document.visibilityState===`visible`&&e.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=re(n=>{n.includes(`files`)&&t===null&&(t=setTimeout(()=>{t=null,e.request()},300))});return()=>{t!==null&&clearTimeout(t),e.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},R=[],t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,p.useEffect)(L,R);let z,B,V,H,U,W,G,K;if(t[11]!==D||t[12]!==b||t[13]!==T||t[14]!==C||t[15]!==_||t[16]!==u||t[17]!==i){W=se(i,D);let e;t[26]!==D||t[27]!==u?(e=g(u,D),t[26]=D,t[27]=u,t[28]=e):e=t[28],U=e,H=_,z=b,B=T,V=new Set([...ne(W),...C]),G=l(W,o),K=c(W,o),t[11]=D,t[12]=b,t[13]=T,t[14]=C,t[15]=_,t[16]=u,t[17]=i,t[18]=z,t[19]=B,t[20]=V,t[21]=H,t[22]=U,t[23]=W,t[24]=G,t[25]=K}else z=t[18],B=t[19],V=t[20],H=t[21],U=t[22],W=t[23],G=t[24],K=t[25];let q=K,J;t[29]===_?J=t[30]:(J=ee(_),t[29]=_,t[30]=J);let Y=J,X,Z;t[31]!==z||t[32]!==B||t[33]!==V||t[34]!==Y||t[35]!==W||t[36]!==q||t[37]!==G?(X=()=>{te({pages:W,folderPaths:V,pagesBySlug:G,pagesByBasename:q,assetPaths:z,filePaths:B,pageIcons:Y})},Z=[W,V,G,q,z,B,Y],t[31]=z,t[32]=B,t[33]=V,t[34]=Y,t[35]=W,t[36]=q,t[37]=G,t[38]=X,t[39]=Z):(X=t[38],Z=t[39]),(0,p.useEffect)(X,Z);let Q;t[40]!==z||t[41]!==j||t[42]!==B||t[43]!==V||t[44]!==k||t[45]!==H||t[46]!==U||t[47]!==W||t[48]!==q||t[49]!==G?(Q={pages:W,pagesBySlug:G,pagesByBasename:q,pageTitles:U,pageMeta:H,folderPaths:V,assetPaths:z,filePaths:B,loading:k,error:j,refetch:F,addPage:ve},t[40]=z,t[41]=j,t[42]=B,t[43]=V,t[44]=k,t[45]=H,t[46]=U,t[47]=W,t[48]=q,t[49]=G,t[50]=Q):Q=t[50];let $;return t[51]!==n||t[52]!==Q?($=(0,oe.jsx)(h,{value:Q,children:n}),t[51]=n,t[52]=Q,t[53]=$):$=t[53],$}function fe(e){return[e.docName,{size:e.size,modified:e.modified,docExt:e.docExt,icon:e.icon}]}function pe(e){return[e.docName,e.title]}function me(e){return e.docName}function he(e){return _(e),{assetPaths:[],folderPaths:[],filePaths:[]}}function y(){let e=(0,p.use)(h);if(!e)throw Error(`usePageList must be used within <PageListProvider />`);return e}function b(){return(0,p.use)(h)}var x=t(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),S=t(((e,t)=>{var n=x();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),C=t(((e,t)=>{t.exports=S()()}));export{m as a,y as i,v as n,f as o,b as r,d as s,C as t};
1
+ import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./createLucideIcon-DAkhoPjT.js";import{xi as o}from"./dist-DJbbCXtB.js";import{t as s}from"./parse-api-error-BtEL2kxi.js";import{c as ee,f as te,l as c,t as ne,u as l}from"./navigation-targets-DwSgIIy0.js";import{c as re}from"./documents-events-C-mYs64z.js";import{t as u}from"./documents-fetch-Db-Ikele.js";import{r as ie}from"./startup-marks-CyxDWRgR.js";var d=a(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),f=a(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),p=e(r(),1),ae=i();function m(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var oe=n(),h=(0,p.createContext)(null);function se(e,t){if(t.size===0)return new Set(e);let n=new Set(e);for(let e of t)n.add(e);return n}function ce(e,t){if(e.size===0)return new Set;let n=new Set;for(let r of e)t.has(r)||n.add(r);return n}function g(e,t){let n=new Map(e);for(let e of t)n.has(e)||n.set(e,e);return n}async function le(){let e=await fetch(`/api/pages`);if(!e.ok){let t=await e.json().catch(()=>null);throw Error(s(t)??`/api/pages responded with ${e.status}`)}let t=await e.json();return Array.isArray(t.pages)?t.pages:[]}async function ue(){let{ok:e,status:t,body:n}=await u();if(!e)throw Error(s(n)??`/api/documents responded with ${t}`);let r=n??{};return Array.isArray(r.documents)?{assetPaths:r.documents.filter(e=>e.kind===`asset`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path),folderPaths:r.documents.filter(e=>e.kind===`folder`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path),filePaths:r.documents.filter(e=>e.kind===`file`&&typeof e.path==`string`&&e.path.length>0).map(e=>e.path)}:{assetPaths:[],folderPaths:[],filePaths:[]}}function de(e){console.error(`[PageListContext] Failed to load pages:`,e)}function _(e){console.warn(`[PageListContext] Failed to load referenced assets:`,e)}function v(e){let t=(0,ae.c)(54),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,t[0]=r):r=t[0];let[i,a]=(0,p.useState)(r),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=new Map,t[1]=s):s=t[1];let[u,d]=(0,p.useState)(s),f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Map,t[2]=f):f=t[2];let[_,v]=(0,p.useState)(f),y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=new Set,t[3]=y):y=t[3];let[b,x]=(0,p.useState)(y),S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=new Set,t[4]=S):S=t[4];let[C,ge]=(0,p.useState)(S),w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=new Set,t[5]=w):w=t[5];let[T,_e]=(0,p.useState)(w),E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=new Set,t[6]=E):E=t[6];let[D,O]=(0,p.useState)(E),[k,A]=(0,p.useState)(!0),[j,M]=(0,p.useState)(null),N=(0,p.useRef)(0),P;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(){let e=N.current+=1;return Promise.all([le(),ue().catch(he)]).then(t=>{let[n,r]=t;if(e!==N.current)return;let i=new Set(n.map(me));a(i),d(new Map(n.map(pe))),v(new Map(n.map(fe))),x(new Set(r.assetPaths)),ge(new Set(r.folderPaths)),_e(new Set(r.filePaths)),O(e=>ce(e,i)),M(null),ie()}).catch(t=>{e===N.current&&(de(t),M(t instanceof Error?t.message:`Failed to load pages`))}).finally(()=>{e===N.current&&A(!1)})},t[7]=P):P=t[7];let F=P,I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){O(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n}),M(null)},t[8]=I):I=t[8];let ve=I,L,R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=m(F);e.request();let t=null,n=()=>{document.visibilityState===`visible`&&e.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=re(n=>{n.includes(`files`)&&t===null&&(t=setTimeout(()=>{t=null,e.request()},300))});return()=>{t!==null&&clearTimeout(t),e.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},R=[],t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,p.useEffect)(L,R);let z,B,V,H,U,W,G,K;if(t[11]!==D||t[12]!==b||t[13]!==T||t[14]!==C||t[15]!==_||t[16]!==u||t[17]!==i){W=se(i,D);let e;t[26]!==D||t[27]!==u?(e=g(u,D),t[26]=D,t[27]=u,t[28]=e):e=t[28],U=e,H=_,z=b,B=T,V=new Set([...ne(W),...C]),G=l(W,o),K=c(W,o),t[11]=D,t[12]=b,t[13]=T,t[14]=C,t[15]=_,t[16]=u,t[17]=i,t[18]=z,t[19]=B,t[20]=V,t[21]=H,t[22]=U,t[23]=W,t[24]=G,t[25]=K}else z=t[18],B=t[19],V=t[20],H=t[21],U=t[22],W=t[23],G=t[24],K=t[25];let q=K,J;t[29]===_?J=t[30]:(J=ee(_),t[29]=_,t[30]=J);let Y=J,X,Z;t[31]!==z||t[32]!==B||t[33]!==V||t[34]!==Y||t[35]!==W||t[36]!==q||t[37]!==G?(X=()=>{te({pages:W,folderPaths:V,pagesBySlug:G,pagesByBasename:q,assetPaths:z,filePaths:B,pageIcons:Y})},Z=[W,V,G,q,z,B,Y],t[31]=z,t[32]=B,t[33]=V,t[34]=Y,t[35]=W,t[36]=q,t[37]=G,t[38]=X,t[39]=Z):(X=t[38],Z=t[39]),(0,p.useEffect)(X,Z);let Q;t[40]!==z||t[41]!==j||t[42]!==B||t[43]!==V||t[44]!==k||t[45]!==H||t[46]!==U||t[47]!==W||t[48]!==q||t[49]!==G?(Q={pages:W,pagesBySlug:G,pagesByBasename:q,pageTitles:U,pageMeta:H,folderPaths:V,assetPaths:z,filePaths:B,loading:k,error:j,refetch:F,addPage:ve},t[40]=z,t[41]=j,t[42]=B,t[43]=V,t[44]=k,t[45]=H,t[46]=U,t[47]=W,t[48]=q,t[49]=G,t[50]=Q):Q=t[50];let $;return t[51]!==n||t[52]!==Q?($=(0,oe.jsx)(h,{value:Q,children:n}),t[51]=n,t[52]=Q,t[53]=$):$=t[53],$}function fe(e){return[e.docName,{size:e.size,modified:e.modified,docExt:e.docExt,icon:e.icon}]}function pe(e){return[e.docName,e.title]}function me(e){return e.docName}function he(e){return _(e),{assetPaths:[],folderPaths:[],filePaths:[]}}function y(){let e=(0,p.use)(h);if(!e)throw Error(`usePageList must be used within <PageListProvider />`);return e}function b(){return(0,p.use)(h)}var x=t(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),S=t(((e,t)=>{var n=x();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),C=t(((e,t)=>{t.exports=S()()}));export{m as a,y as i,v as n,f as o,b as r,d as s,C as t};
@@ -1,2 +1,2 @@
1
- import{gn as e}from"./dist-Cv2LF2DL.js";function t(t){return e(t)}function n(e,t){switch(e.kind){case`ok`:return null;case`not-git`:return`This folder doesn't contain a git repository. Pick a different folder?`;case`wrong-repo`:return`This folder is a clone of ${e.actualOwner}/${e.actualRepo}, not ${t.owner}/${t.repo}. Pick a different folder?`;case`wrong-host`:return`This folder is a clone of ${t.owner}/${t.repo} on ${e.actualHost}, not ${t.host}. Pick a folder cloned from ${t.host}?`;case`no-origin`:case`non-github`:case`symlink-escape`:return`This folder isn't a clone of ${t.owner}/${t.repo}. Pick a different folder?`}}function r(e){return e.kind===`unsupported-version`?{kind:`unsupported-version`,message:`Update OpenKnowledge to open this share.`}:e.kind===`invalid`?{kind:`invalid`,message:`Invalid share URL.`}:null}function i(e){let t=e.split(`
1
+ import{gn as e}from"./dist-DJbbCXtB.js";function t(t){return e(t)}function n(e,t){switch(e.kind){case`ok`:return null;case`not-git`:return`This folder doesn't contain a git repository. Pick a different folder?`;case`wrong-repo`:return`This folder is a clone of ${e.actualOwner}/${e.actualRepo}, not ${t.owner}/${t.repo}. Pick a different folder?`;case`wrong-host`:return`This folder is a clone of ${t.owner}/${t.repo} on ${e.actualHost}, not ${t.host}. Pick a folder cloned from ${t.host}?`;case`no-origin`:case`non-github`:case`symlink-escape`:return`This folder isn't a clone of ${t.owner}/${t.repo}. Pick a different folder?`}}function r(e){return e.kind===`unsupported-version`?{kind:`unsupported-version`,message:`Update OpenKnowledge to open this share.`}:e.kind===`invalid`?{kind:`invalid`,message:`Invalid share URL.`}:null}function i(e){let t=e.split(`
2
2
  `).map(e=>e.trim()).filter(e=>e.length>0&&!/^Cloning into /i.test(e)),n=t.filter(e=>/^remote:/i.test(e)),r=n[n.length-1];if(r)return r.replace(/^remote:\s*/i,``).trim();let i=t.find(e=>/^fatal:/i.test(e));return i?i.replace(/^fatal:\s*/i,``).trim():t[0]??``}function a(e){let t=[`[receive]`];return e.q2_path!==void 0&&t.push(`q2_path=${e.q2_path}`),e.folder_validate!==void 0&&t.push(`folder_validate=${e.folder_validate}`),e.branch_action!==void 0&&t.push(`branch_action=${e.branch_action}`),e.branch!==void 0&&t.push(`branch=${e.branch}`),e.doc_check!==void 0&&t.push(`doc_check=${e.doc_check}`),e.branch_dialog_action!==void 0&&t.push(`branch_dialog_action=${e.branch_dialog_action}`),e.verdict_cell!==void 0&&t.push(`verdict_cell=${e.verdict_cell}`),t.join(` `)}function o(){let e=null,t=new Set,n=!1,r=null;function i(){for(let e of t)e()}function a(){e!==null&&(e=null,i())}return{install({bridge:t}){if(t)return n?r??void 0:(n=!0,r=t.onShareReceived(t=>{e=t,i()}),()=>{r?.(),r=null,n=!1,a()})},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dismiss(){a()}}}var s=o();function c(e){return s.install(e)}export{a,i,s as n,n as o,t as r,r as s,c as t};
@@ -1,4 +1,4 @@
1
- import{T as e}from"./DocumentContext-QeD0oigI.js";function t(e){return e.lineCount===1&&e.charLen<100?{kind:`inline`,markdown:e.markdown}:e.surface===`source`&&e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?{kind:`lines`,startLine:e.sourceLineStart,endLine:e.sourceLineEnd}:{kind:`anchor`,markdown:e.markdown}}function n(e,t){return e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?`${t} (${e.sourceLineStart===e.sourceLineEnd?`${e.sourceLineStart}`:`${e.sourceLineStart}-${e.sourceLineEnd}`})`:e.lineCount>1?`${t} (${e.lineCount} lines)`:`${t} (selection)`}function r(e){let t=e.replace(/\r\n/g,`
1
+ import{T as e}from"./DocumentContext-uE-Jpe8-.js";function t(e){return e.lineCount===1&&e.charLen<100?{kind:`inline`,markdown:e.markdown}:e.surface===`source`&&e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?{kind:`lines`,startLine:e.sourceLineStart,endLine:e.sourceLineEnd}:{kind:`anchor`,markdown:e.markdown}}function n(e,t){return e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?`${t} (${e.sourceLineStart===e.sourceLineEnd?`${e.sourceLineStart}`:`${e.sourceLineStart}-${e.sourceLineEnd}`})`:e.lineCount>1?`${t} (${e.lineCount} lines)`:`${t} (selection)`}function r(e){let t=e.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),n=[],r=!1;for(let e of t){let t=e.trim();if(/^(```|~~~)/.test(t)){r||n.push(`code`),r=!r;continue}if(r||t===``)continue;if(/^\|.*\|?$/.test(t)&&t.includes(`|`)){n[n.length-1]!==`table`&&n.push(`table`);continue}if(/^<\/?[A-Za-z]/.test(t)){n[n.length-1]!==`component`&&n.push(`component`);continue}let i=t.match(/^#{1,6}\s+(.*)$/);if(i){n.push(i[1]??``);continue}let a=t.match(/^[-*+]\s+(.*)$/);if(a){n.push(`• ${a[1]??``}`);continue}let o=t.match(/^\d+\.\s+(.*)$/);if(o){n.push(`• ${o[1]??``}`);continue}let s=t.match(/^>\s?(.*)$/);if(s){n.push(s[1]??``);continue}n.push(t)}return n.join(` `).replace(/\s+/g,` `).trim()}var i=new Map,a=new Set,o=(e,t)=>`${t}:${e}`;function s(){for(let e of a)e()}function c(e,t){return e.markdown===t.markdown&&e.sourceLineStart===t.sourceLineStart&&e.sourceLineEnd===t.sourceLineEnd}function l(e,t,n){let r=o(e,t);if(n===null){i.delete(r)&&s();return}let a=i.get(r);a&&c(a,n)||(i.set(r,n),s())}function u(e,t){return e===null?null:i.get(o(e,t))??null}function d(e){return a.add(e),()=>{a.delete(e)}}function f(t,n){if(t.state.selection.empty)return null;let r=e(t);return r.trim()?{surface:`wysiwyg`,docName:n,markdown:r,charLen:r.trim().length,lineCount:(r.match(/\n/g)?.length??0)+1}:null}function p(e,t){return e.trim()?{surface:`frontmatter`,docName:t,markdown:e,charLen:e.trim().length,lineCount:(e.match(/\n/g)?.length??0)+1}:null}function m(e,t){let n=[],r=1/0,i=-1;for(let t of e.state.selection.ranges)t.empty||(n.push(e.state.sliceDoc(t.from,t.to)),r=Math.min(r,t.from),i=Math.max(i,t.to));if(n.length===0)return null;let a=n.join(`
4
4
  `);if(!a.trim())return null;let o=e.state.doc.lineAt(r).number,s=e.state.doc.lineAt(i).number;return{surface:`source`,docName:t,markdown:a,charLen:a.trim().length,lineCount:s-o+1,sourceLineStart:o,sourceLineEnd:s}}export{p as a,t as c,n as i,d as l,r as n,m as o,l as r,f as s,u as t};
@@ -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"./createLucideIcon-DAkhoPjT.js";import{t as s}from"./button-Gol9BgNB.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dialog-6-bc7qPg.js";import{a as g,d as _,f as v,i as y,o as b,p as x,u as S}from"./dropdown-menu-xw8WTdb-.js";import{t as C}from"./label-DyipnO5I.js";import{C as w,a as T,f as E,h as D,m as O,n as k,o as A,p as j,r as M,s as N,t as P}from"./agent-visibility-mwTztYpe.js";import{An as F,Dn as I,Ei as L,En as R,Fn as z,Gt as B,Kt as V,Mn as H,Nn as U,On as W,Pn as G,Pt as K,Tn as q,Ut as J,an as ee,dt as te,fn as ne,ft as re,pn as ie,un as Y,z as ae}from"./dist-Cv2LF2DL.js";import{t as oe}from"./RegisteredAgentIcon-CyQDojW_.js";import{a as se,d as ce,l as le,n as ue,r as de,t as fe,u as pe}from"./workspace-paths-DGKkpMQ9.js";import{t as me}from"./copy-9EDFYcyR.js";import{t as he}from"./folder-open-wLd69QUc.js";import{t as ge}from"./loader-circle-Cg5SU7AZ.js";import{t as _e}from"./refresh-cw-DClG_qgN.js";import{t as ve}from"./sliders-horizontal-BNv-Koqw.js";import{t as ye}from"./trash-2-DE3a7L75.js";import{n as X}from"./dist-B8I5m7M1.js";import{t as be}from"./input-D4OPkja2.js";import{t as xe}from"./dist-BCZq3DKc.js";import{i as Se}from"./use-settings-route-KYTTaHV0.js";import{t as Ce}from"./parse-api-error-BtEL2kxi.js";import{c as we,l as Te}from"./documents-events-DJXnk07Z.js";import{n as Ee}from"./config-context-D3FvmHZm.js";import{t as De}from"./use-workspace-CNU53RmX.js";import{n as Oe}from"./clipboard-adapter-ZCy01ehf.js";import{a as ke,d as Ae,f as je,n as Me,s as Ne,t as Pe}from"./skills-api-141pFhWO.js";var Fe=o(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Ie=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Le=o(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Re=o(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=t(),Q=e(n(),1),$=a();function ze(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Be(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ce(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ve(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?ze(e):Be()}var He=`ok:skill:cowork:installed`,Ue=`1`,We=250,Ge=`/api/skill/install-state`;function Ke(e){return`${He}:v${e}`}var qe=new Map;async function Je(e={},t={}){let n=t.force?`__force__`:`__default__`,r=qe.get(n);if(r)return r;let i=Ye(e,t);return qe.set(n,i),i.finally(()=>{qe.get(n)===i&&qe.delete(n)}),i}async function Ye(e,t){let n=e.installer===void 0?Ve():e.installer,r=Xe(e.storage),i=e.fetchSnapshot??Qe,a=e.serverTimeoutMs??We,o=null;if(!t.force){try{o=await $e(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Ke(o?.currentVersion??e.fallbackSkillVersion??Ze());if(!t.force&&r?.getItem(s)===Ue)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Ue)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Xe(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ze(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Qe(){let e;try{e=await fetch(Ge,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function $e(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function et(e){return Je({},e)}function tt(){return Je({},{force:!0})}async function nt(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function rt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return nt({target:`claude-cowork`,url:Y({mode:`cowork`},e)},n);case`claude-code`:return nt({target:`claude-code`,url:Y({mode:`code`},e)},n);case`codex`:return nt({target:`codex`,url:ne(e)},n);case`cursor`:return nt({target:`cursor`,url:ie(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function it(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var at=`open-knowledge:agent-thread-launch`;function ot(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(at,{detail:e}))}function st(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(at,n),()=>t.removeEventListener(at,n)}function ct(e){if(!e.docName||!e.workspace)return null;let t=fe(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:ue(n,t,r)}}function lt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function ut(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function dt(e){return j(e.installUrl).then(()=>void 0)}function ft(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function pt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function mt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??fe(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:ue(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function ht(e){return`Opened in ${e}.`}function gt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function _t(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function vt(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function yt(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function bt(e,t,n,r){return e.compose?ee(yt(e.compose,t,n,r)):e.selection?H({...e.selection,target:t,transport:r}):e.skill?U(e.skill.name,e.skill.scope,n):e.ask?q(e.ask.relativePath,e.ask.instruction,n,t,r):L(e.docContext===null?e.folderRelativePath?F(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?I(n,e.instruction,r):R(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):W(e.docContext.relativePath,n,e.instruction,r))}function xt(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${te} ${bt(e,B[t].handoffTarget,!1,`terminal`)}`:G(e.docContext?.relativePath??null)}function St(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${re} ${bt(e,`claude-code`,!1,`terminal`)}`:z(e.docContext?.relativePath??null)}function Ct(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function wt(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function Tt(e,t){ot({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:St(e),docName:Ct(e),titleHint:wt(e)})}async function Et(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:bt(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=vt(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(ht(u));else{let i=_t(r),a=gt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Et(e,t,n,r+1)}}})}return a}function Dt(e){return O.find(t=>t.id===e)?.displayName??e}function Ot(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function kt(){return{dispatchHandoff:rt,recordHandoff:it,toast:{success:e=>{X.success(e)},error:(e,t)=>{X.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Ot(),getDisplayName:Dt,ensureCoworkSkillInstalled:et,autoOpen:!0}}function At(){let e=(0,$.c)(2),{merged:t}=Ee(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>Et(e,t,{...kt(),autoOpen:n}),reinstallCoworkSkill:tt},e[0]=n,e[1]=r),r}var jt=[...new Set(O.flatMap(e=>e.schemes))];function Mt(e,t){let n=t.now?.()??Date.now(),r={};for(let t of O){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Nt(e){return Mt({},e)}async function Pt(e){let t=e.schemes??jt,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Ft=Object.fromEntries(jt.map(e=>[e,{installed:!1}]));async function It(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Ft}if(!t.ok)return Ft;let n;try{n=await t.json()}catch{return Ft}if(typeof n!=`object`||!n||Array.isArray(n))return Ft;let r=n,i={};for(let e of jt)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Lt(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function Rt(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Nt({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Mt(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Lt(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function zt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Bt(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Pt({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>It({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Vt(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Ht),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Rt(Bt());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Ht(){return Nt({isElectronHost:zt(),now:Date.now})}var Ut=(0,Q.createContext)(null);function Wt(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Ut,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Gt(){return(0,Q.use)(Ut)}function Kt(e){let t=(0,$.c)(48),{itemName:n,isSubmitting:a,onDelete:o,customTitle:h,customDescription:g,customDetail:_,customConfirmLabel:v,customConfirmLabelBusy:y,children:b}=e,{_:x}=i(),S;t[0]!==x||t[1]!==n?(S=n??x({id:`L3CEC1`}),t[0]=x,t[1]=n,t[2]=S):S=t[2];let C=S,w;t[3]!==x||t[4]!==v?(w=v??x({id:`cnGeoo`}),t[3]=x,t[4]=v,t[5]=w):w=t[5];let T=w,E;t[6]!==x||t[7]!==v||t[8]!==y?(E=y??v??x({id:`s3caR3`}),t[6]=x,t[7]=v,t[8]=y,t[9]=E):E=t[9];let D=E,O;t[10]!==x||t[11]!==h||t[12]!==C?(O=h??x({id:`77SdEP`,values:{itemName:C}}),t[10]=x,t[11]=h,t[12]=C,t[13]=O):O=t[13];let k;t[14]===O?k=t[15]:(k=(0,Z.jsx)(l,{children:O}),t[14]=O,t[15]=k);let A;t[16]!==x||t[17]!==g||t[18]!==C?(A=g??x({id:`16D5Zj`,values:{itemName:C}}),t[16]=x,t[17]=g,t[18]=C,t[19]=A):A=t[19];let j;t[20]===A?j=t[21]:(j=(0,Z.jsx)(c,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===_?M=t[23]:(M=_?(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:_}):null,t[22]=_,t[23]=M);let N;t[24]!==k||t[25]!==j||t[26]!==M?(N=(0,Z.jsxs)(m,{children:[k,j,M]}),t[24]=k,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]===b?P=t[29]:(P=b?(0,Z.jsx)(d,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(r,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===a?I=t[32]:(I=(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(s,{variant:`outline`,disabled:a,children:F})}),t[31]=a,t[32]=I);let L;t[33]!==T||t[34]!==D||t[35]!==a?(L=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ge,{className:`size-4 animate-spin`}),` `,D]}):T,t[33]=T,t[34]=D,t[35]=a,t[36]=L):L=t[36];let R;t[37]!==a||t[38]!==o||t[39]!==L?(R=(0,Z.jsx)(s,{variant:`destructive`,onClick:o,disabled:a,children:L}),t[37]=a,t[38]=o,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==I||t[42]!==R?(z=(0,Z.jsxs)(f,{children:[I,R]}),t[41]=I,t[42]=R,t[43]=z):z=t[43];let B;return t[44]!==P||t[45]!==z||t[46]!==N?(B=(0,Z.jsxs)(u,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function qt(e){return e?xe._({id:`wTcjov`}):null}function Jt(e){let t=(0,$.c)(47),{_:n}=i(),a=de(),o=Gt(),s=w(),c=E();if(a)return null;let{input:l,installStates:u,dispatch:d,onBeforeLaunch:f}=e,p=l===null,m,h,C,O,j,F,I,L,R,z,H;if(t[0]!==n||t[1]!==d||t[2]!==l||t[3]!==p||t[4]!==u||t[5]!==f||t[6]!==c||t[7]!==s||t[8]!==o){let e=qt(p),i;t[20]===c?i=t[21]:(i=e=>P(c,e.id),t[20]=c,t[21]=i);let a=D.filter(i),w;t[22]===c?w=t[23]:(w=e=>k(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=w);let E=s.filter(w),U=o?V.filter(e=>M(c,e,o.installedClis)):[];C=a.length>0,O=o!==null&&U.length>0,j=E.length>0,h=_,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(le,{"aria-hidden":`true`}),(0,Z.jsx)(r,{id:`O7_W_a`})]}),t[24]=H):H=t[24],m=v,F=`max-h-80`,I=j?(0,Z.jsxs)(y,{"aria-label":n({id:`vPKX2i`}),children:[(0,Z.jsxs)(b,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(r,{id:`RXEbZy`}),(0,Z.jsx)(N,{})]}),E.map(t=>{let i=t.name;return(0,Z.jsxs)(g,{onSelect:()=>{l!==null&&(f?.(),Tt(l,{agent:{source:t.source,id:t.id}}))},disabled:p,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:i,hint:e}}):void 0,children:[(0,Z.jsx)(oe,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(r,{id:`5PrrYw`,values:{agentName:i}})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==C||t[26]!==O||t[27]!==j?(L=j&&(O||C)?(0,Z.jsx)(S,{}):null,t[25]=C,t[26]=O,t[27]=j,t[28]=L):L=t[28],R=O?(0,Z.jsxs)(y,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(b,{children:(0,Z.jsx)(r,{id:`ALhMYW`})}),U.map(t=>{let{displayName:r}=B[t];return(0,Z.jsxs)(g,{onSelect:()=>{l!==null&&(f?.(),o.launchInTerminal(l,t))},disabled:p,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(A,{id:T(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,z=C?(0,Z.jsxs)(Z.Fragment,{children:[O?(0,Z.jsx)(S,{}):null,(0,Z.jsxs)(y,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(b,{children:(0,Z.jsx)(r,{id:`BBqGS9`})}),a.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(g,{disabled:!r,onSelect:()=>{if(l){if(f?.(),u[t.id]?.installed!==!0){dt(t);return}d(t.id,l)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(A,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=d,t[2]=l,t[3]=p,t[4]=u,t[5]=f,t[6]=c,t[7]=s,t[8]=o,t[9]=m,t[10]=h,t[11]=C,t[12]=O,t[13]=j,t[14]=F,t[15]=I,t[16]=L,t[17]=R,t[18]=z,t[19]=H}else m=t[9],h=t[10],C=t[11],O=t[12],j=t[13],F=t[14],I=t[15],L=t[16],R=t[17],z=t[18],H=t[19];let U;t[29]!==C||t[30]!==O||t[31]!==j?(U=j||O||C?(0,Z.jsx)(S,{}):null,t[29]=C,t[30]=O,t[31]=j,t[32]=U):U=t[32];let W;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(ve,{"aria-hidden":`true`}),t[33]=W):W=t[33];let G;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsxs)(g,{onSelect:Se,"data-testid":`file-tree-open-in-settings`,children:[W,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(r,{id:`jRAGrQ`})})]}),t[34]=G):G=t[34];let K;t[35]!==m||t[36]!==F||t[37]!==I||t[38]!==L||t[39]!==R||t[40]!==z||t[41]!==U?(K=(0,Z.jsxs)(m,{className:F,children:[I,L,R,z,U,G]}),t[35]=m,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z,t[41]=U,t[42]=K):K=t[42];let q;return t[43]!==h||t[44]!==H||t[45]!==K?(q=(0,Z.jsxs)(h,{children:[H,K]}),t[43]=h,t[44]=H,t[45]=K,t[46]=q):q=t[46],q}function Yt(e){let t=(0,$.c)(8),n=e?.enabled??!0,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`idle`},t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(0),c,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=()=>s($t),t=Te(e),n=we(t=>{t.includes(`files`)&&e()});return()=>{t(),n()}},l=[],t[1]=c,t[2]=l):(c=t[1],l=t[2]),(0,Q.useEffect)(c,l);let u;t[3]===n?u=t[4]:(u=()=>{if(!n)return;let e=!1;return a(Qt),fetch(`/api/skills`).then(Xt).then(t=>{if(e)return;let n=J.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skills response failed schema validation:`,n.error.issues),a({status:`error`,message:`Server returned an incomplete skills response.`});return}a({status:`ready`,data:n.data.skills})}).catch(t=>{e||a({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},t[3]=n,t[4]=u);let d;return t[5]!==n||t[6]!==o?(d=[o,n],t[5]=n,t[6]=o,t[7]=d):d=t[7],(0,Q.useEffect)(u,d),i}async function Xt(e){if(!e.ok){let t=await e.json().catch(Zt);throw Error(Ce(t)??`HTTP ${e.status}`)}return e.json()}function Zt(){return null}function Qt(e){return e.status===`ready`?e:{status:`loading`}}function $t(e){return e+1}function en(e){let t=(0,$.c)(16),{skill:n,onOpenChange:r,onDeleted:a}=e,{_:o}=i(),[s,c]=(0,Q.useState)(!1),l;t[0]!==o||t[1]!==a||t[2]!==r?(l=async function(e){c(!0);let t=await Pe(e.scope,e.name);if(c(!1),!t.ok){let{error:e}=t;X.error(o({id:`AtBdnD`,values:{error:e}}));return}X.success(o({id:`h9QFb9`,values:{0:e.name}})),a(),r(!1)},t[0]=o,t[1]=a,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==s||t[5]!==r?(f=e=>{!e&&!s&&r(!1)},t[4]=s,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==n?(p=n?(0,Z.jsx)(Kt,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:s,onDelete:()=>u(n),customDescription:o({id:`E1Da_b`,values:{0:n.path}})}):null,t[7]=o,t[8]=s,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,Z.jsx)(h,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function tn(e){let t=(0,$.c)(68),{skill:n,existingNames:a,onOpenChange:o,onRenamed:d}=e,{_:p}=i(),g=n!==null,_=(0,Q.useId)(),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(!1),S;t[0]===n?S=t[1]:(S=()=>{n&&y(n.name)},t[0]=n,t[1]=S);let w=n?.scope,T=n?.name,E;if(t[2]!==w||t[3]!==T?(E=[w,T],t[2]=w,t[3]=T,t[4]=E):E=t[4],(0,Q.useEffect)(S,E),!n)return null;let D,O,k,A;t[5]!==a||t[6]!==v||t[7]!==n.name?(k=v.trim(),A=k===n.name,D=k===``||!K.test(k),O=!D&&!A&&a.has(k),t[5]=a,t[6]=v,t[7]=n.name,t[8]=D,t[9]=O,t[10]=k,t[11]=A):(D=t[8],O=t[9],k=t[10],A=t[11]);let j=O,M=!D&&!j&&!A&&!b,N;t[12]!==p||t[13]!==M||t[14]!==o||t[15]!==d||t[16]!==n||t[17]!==k?(N=async function(){if(!n||!M)return;x(!0);let e=await Ne({scope:n.scope,fromName:n.name,toName:k});if(x(!1),!e.ok){X.error(p({id:`zKxoPm`,values:{0:n.name,1:e.error}}));return}X.success(p({id:`dUCQo4`,values:{trimmed:k}})),d?.(k),o(!1)},t[12]=p,t[13]=M,t[14]=o,t[15]=d,t[16]=n,t[17]=k,t[18]=N):N=t[18];let P=N,F;t[19]===o?F=t[20]:(F=e=>e?null:o(!1),t[19]=o,t[20]=F);let I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(l,{children:(0,Z.jsx)(r,{id:`dw_3cv`})}),t[21]=I):I=t[21];let L;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsxs)(m,{children:[I,(0,Z.jsx)(c,{children:(0,Z.jsx)(r,{id:`R9IDFz`})})]}),t[22]=L):L=t[22];let R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(r,{id:`6YtxFj`}),t[23]=R):R=t[23];let z;t[24]===_?z=t[25]:(z=(0,Z.jsx)(C,{htmlFor:_,children:R}),t[24]=_,t[25]=z);let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>y(e.target.value),t[26]=B):B=t[26];let V;t[27]===P?V=t[28]:(V=e=>{e.key===`Enter`&&P()},t[27]=P,t[28]=V);let H=D||j,U=D&&k!==``||j?`${_}-error`:void 0,W;t[29]!==_||t[30]!==v||t[31]!==V||t[32]!==H||t[33]!==U?(W=(0,Z.jsx)(be,{id:_,value:v,onChange:B,onKeyDown:V,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":H,"aria-describedby":U,className:`font-mono`}),t[29]=_,t[30]=v,t[31]=V,t[32]=H,t[33]=U,t[34]=W):W=t[34];let G;t[35]!==j||t[36]!==_||t[37]!==D||t[38]!==k?(G=D&&k!==``?(0,Z.jsx)(`p`,{id:`${_}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(r,{id:`A50vr3`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):j?(0,Z.jsx)(`p`,{id:`${_}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(r,{id:`YJ1BTp`})}):null,t[35]=j,t[36]=_,t[37]=D,t[38]=k,t[39]=G):G=t[39];let q;t[40]!==z||t[41]!==W||t[42]!==G?(q=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[z,W,G]}),t[40]=z,t[41]=W,t[42]=G,t[43]=q):q=t[43];let J;t[44]===o?J=t[45]:(J=()=>o(!1),t[44]=o,t[45]=J);let ee;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(r,{id:`dEgA5A`}),t[46]=ee):ee=t[46];let te;t[47]!==b||t[48]!==J?(te=(0,Z.jsx)(s,{variant:`ghost`,onClick:J,disabled:b,children:ee}),t[47]=b,t[48]=J,t[49]=te):te=t[49];let ne;t[50]===P?ne=t[51]:(ne=()=>void P(),t[50]=P,t[51]=ne);let re=!M,ie;t[52]===b?ie=t[53]:(ie=b?(0,Z.jsx)(r,{id:`tHKQ6j`}):(0,Z.jsx)(r,{id:`2wxgft`}),t[52]=b,t[53]=ie);let Y;t[54]!==ne||t[55]!==re||t[56]!==ie?(Y=(0,Z.jsx)(s,{onClick:ne,disabled:re,children:ie}),t[54]=ne,t[55]=re,t[56]=ie,t[57]=Y):Y=t[57];let ae;t[58]!==te||t[59]!==Y?(ae=(0,Z.jsxs)(f,{children:[te,Y]}),t[58]=te,t[59]=Y,t[60]=ae):ae=t[60];let oe;t[61]!==q||t[62]!==ae?(oe=(0,Z.jsxs)(u,{children:[L,q,ae]}),t[61]=q,t[62]=ae,t[63]=oe):oe=t[63];let se;return t[64]!==g||t[65]!==oe||t[66]!==F?(se=(0,Z.jsx)(h,{open:g,onOpenChange:F,children:oe}),t[64]=g,t[65]=oe,t[66]=F,t[67]=se):se=t[67],se}function nn(e){let t=(0,$.c)(15),{skill:n,onOpenChange:a,onUpdated:o}=e,{_:g}=i(),[_,v]=(0,Q.useState)(!1),y;t[0]!==g||t[1]!==a||t[2]!==o?(y=async function(e){v(!0);let t=await je({scope:e.scope,name:e.name});v(!1);let n=se(e.name);if(!t.ok){X.error(g({id:`FRqZ9v`,values:{0:t.error}}));return}X.success(t.checkpointRef?g({id:`My9uXI`,values:{0:t.version,display:n}}):g({id:`mPneVR`,values:{0:t.version,display:n}})),o(),a(!1)},t[0]=g,t[1]=a,t[2]=o,t[3]=y):y=t[3];let b=y,x=n!==null,S;t[4]!==a||t[5]!==_?(S=e=>{!e&&!_&&a(!1)},t[4]=a,t[5]=_,t[6]=S):S=t[6];let C;t[7]!==b||t[8]!==n||t[9]!==_?(C=n?(0,Z.jsxs)(u,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(m,{children:[(0,Z.jsx)(l,{children:(0,Z.jsx)(r,{id:`iAoh55`,values:{0:se(n.name)}})}),(0,Z.jsx)(c,{children:n.installedVersion?(0,Z.jsx)(r,{id:`47EXvY`,values:{0:n.bundledVersion??``,1:n.installedVersion}}):(0,Z.jsx)(r,{id:`nD7Fx9`,values:{0:n.bundledVersion??``}})})]}),(0,Z.jsx)(d,{}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(s,{variant:`outline`,disabled:_,children:(0,Z.jsx)(r,{id:`dEgA5A`})})}),(0,Z.jsx)(s,{onClick:()=>void b(n),disabled:_,children:_?(0,Z.jsx)(r,{id:`JL3si7`}):(0,Z.jsx)(r,{id:`EkH9pt`})})]})]}):null,t[7]=b,t[8]=n,t[9]=_,t[10]=C):C=t[10];let w;return t[11]!==x||t[12]!==S||t[13]!==C?(w=(0,Z.jsx)(h,{open:x,onOpenChange:S,children:C}),t[11]=x,t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function rn(){let e=(0,$.c)(30),{_:t}=i(),[n,r]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),d;e[0]===t?d=e[1]:(d=async function(e,n){u(e.name);let r=await ke({scope:e.scope,name:e.name,...n?{targets:[...n]}:{}});if(u(null),!r.ok)return X.error(t({id:`Mj8R8K`,values:{0:r.error}})),r;let i=an,a=new Set(r.hosts),o=r.hosts.filter(t=>!e.hosts.includes(t)),s=e.hosts.filter(e=>!a.has(e)),c=e=>{let t=r.warningCodes.indexOf(e);return t>=0?r.warnings[t]:void 0},l=c(`no-targets`);if(l)return X.warning(l),r;if(o.length>0){let e=c(`scripts-present`);e&&X.warning(e)}return r.hosts.length===0?X.success(t({id:`0LBDjY`,values:{0:e.name}})):o.length>0&&s.length===0?X.success(t({id:`PPFQ3o`,values:{0:e.name,1:i(o)}})):s.length>0&&o.length===0?X.success(t({id:`OOIVJo`,values:{0:e.name,1:i(s)}})):o.length>0&&s.length>0?X.success(t({id:`OxplNM`,values:{0:e.name,1:i(o),2:i(s)}})):X.success(t({id:`wDgmsr`,values:{0:e.name,1:i(r.hosts)}})),r},e[0]=t,e[1]=d);let f=d,p;e[2]===t?p=e[3]:(p=async function(e){u(e.name);let n=await Ae({scope:e.scope,name:e.name});return u(null),n.ok?X.success(t({id:`0LBDjY`,values:{0:e.name}})):X.error(t({id:`nJq7et`,values:{0:n.error}})),n},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=async function(e,n){let r=await Me({scope:e.scope,name:e.name,existingNames:n});if(!r.ok){X.error(t({id:`UPjaXD`,values:{0:e.name,1:r.error}}));return}X.success(t({id:`0g7rCZ`,values:{0:r.name}}))},e[4]=t,e[5]=h);let g=h,_,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{e||r(null)},v=()=>r(null),e[6]=_,e[7]=v):(_=e[6],v=e[7]);let y;e[8]===n?y=e[9]:(y=(0,Z.jsx)(en,{skill:n,onOpenChange:_,onDeleted:v}),e[8]=n,e[9]=y);let b=a?.skill??null,x=a?.existingNames??sn,S,C;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e||o(null)},C=()=>o(null),e[10]=S,e[11]=C):(S=e[10],C=e[11]);let w;e[12]!==b||e[13]!==x?(w=(0,Z.jsx)(tn,{skill:b,existingNames:x,onOpenChange:S,onRenamed:C}),e[12]=b,e[13]=x,e[14]=w):w=e[14];let T,E;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||c(null)},E=()=>c(null),e[15]=T,e[16]=E):(T=e[15],E=e[16]);let D;e[17]===s?D=e[18]:(D=(0,Z.jsx)(nn,{skill:s,onOpenChange:T,onUpdated:E}),e[17]=s,e[18]=D);let O;e[19]!==w||e[20]!==D||e[21]!==y?(O=(0,Z.jsxs)(Z.Fragment,{children:[y,w,D]}),e[19]=w,e[20]=D,e[21]=y,e[22]=O):O=e[22];let k=O,A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(e,t)=>o({skill:e,existingNames:t}),e[23]=A):A=e[23];let j;return e[24]!==k||e[25]!==g||e[26]!==f||e[27]!==l||e[28]!==m?(j={installingName:l,install:f,uninstall:m,duplicate:g,requestDelete:r,requestRename:A,requestUpdate:c,dialogs:k},e[24]=k,e[25]=g,e[26]=f,e[27]=l,e[28]=m,e[29]=j):j=e[29],j}function an(e){return e.map(on).join(`, `)}function on(e){return ae[e]??e}var sn=new Set;function cn(e){let t=(0,$.c)(19),{skill:n,onEdit:i,onInstall:a,onUninstall:o,onDelete:s}=e,c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(pe,{"aria-hidden":!0}),l=(0,Z.jsx)(r,{id:`ePK91l`}),t[0]=c,t[1]=l):(c=t[0],l=t[1]);let u;t[2]===i?u=t[3]:(u=(0,Z.jsxs)(g,{onSelect:i,children:[c,l]}),t[2]=i,t[3]=u);let d;t[4]!==a||t[5]!==n.installed?(d=a&&!n.installed?(0,Z.jsxs)(g,{onSelect:a,children:[(0,Z.jsx)(Fe,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`TKQ7K-`})]}):null,t[4]=a,t[5]=n.installed,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.installed?(f=n.installed?(0,Z.jsxs)(g,{onSelect:o,children:[(0,Z.jsx)(Re,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`fo0VXg`})]}):null,t[7]=o,t[8]=n.installed,t[9]=f):f=t[9];let p,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(ye,{"aria-hidden":!0}),m=(0,Z.jsx)(r,{id:`cnGeoo`}),t[10]=p,t[11]=m):(p=t[10],m=t[11]);let h;t[12]===s?h=t[13]:(h=(0,Z.jsxs)(g,{variant:`destructive`,onSelect:s,children:[p,m]}),t[12]=s,t[13]=h);let _;return t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==h?(_=(0,Z.jsxs)(Z.Fragment,{children:[u,d,f,h]}),t[14]=u,t[15]=d,t[16]=f,t[17]=h,t[18]=_):_=t[18],_}function ln(e){let t=(0,$.c)(94),{skill:n,actions:a,existingNames:o}=e,{_:s}=i(),c=De(),l=Vt().states,{dispatch:u}=At(),d=typeof window<`u`?window.okDesktop:void 0,f=n.absolutePath,p;t[0]===s?p=t[1]:(p=async function(e){try{await Oe(e),X.success(s({id:`SXCSQd`}))}catch{X.error(s({id:`cRHuuI`}))}},t[0]=s,t[1]=p);let m=p;if(n.managed){let e,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(b,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,Z.jsx)(Ie,{className:`size-3`,"aria-hidden":!0}),(0,Z.jsx)(r,{id:`VITWk5`})]}),i=(0,Z.jsx)(S,{}),t[2]=e,t[3]=i):(e=t[2],i=t[3]);let a;t[4]===f?a=t[5]:(a=d&&f?(0,Z.jsxs)(g,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,Z.jsx)(he,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`LtSYdi`})]}):null,t[4]=f,t[5]=a);let o;t[6]!==n.name||t[7]!==n.scope||t[8]!==c?(o=pt({skillName:n.name,scope:n.scope,workspace:c}),t[6]=n.name,t[7]=n.scope,t[8]=c,t[9]=o):o=t[9];let s;t[10]!==u||t[11]!==l||t[12]!==o?(s=(0,Z.jsx)(Jt,{input:o,installStates:l,isElectronHost:d!=null,dispatch:u}),t[10]=u,t[11]=l,t[12]=o,t[13]=s):s=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(me,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`zd00pH`})]}),t[14]=p):p=t[14];let h;t[15]!==f||t[16]!==m?(h=f?(0,Z.jsx)(g,{onSelect:()=>void m(f),children:(0,Z.jsx)(r,{id:`z2funE`})}):null,t[15]=f,t[16]=m,t[17]=h):h=t[17];let y;t[18]!==m||t[19]!==n.path?(y=()=>void m(n.path),t[18]=m,t[19]=n.path,t[20]=y):y=t[20];let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(r,{id:`xloBjn`}),t[21]=C):C=t[21];let w;t[22]===y?w=t[23]:(w=(0,Z.jsx)(g,{onSelect:y,children:C}),t[22]=y,t[23]=w);let T;t[24]!==w||t[25]!==h?(T=(0,Z.jsxs)(_,{children:[p,(0,Z.jsxs)(v,{children:[h,w]})]}),t[24]=w,t[25]=h,t[26]=T):T=t[26];let E;return t[27]!==T||t[28]!==a||t[29]!==s?(E=(0,Z.jsxs)(Z.Fragment,{children:[e,i,a,s,T]}),t[27]=T,t[28]=a,t[29]=s,t[30]=E):E=t[30],E}let h;t[31]===f?h=t[32]:(h=d&&f?(0,Z.jsxs)(g,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,Z.jsx)(he,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`LtSYdi`})]}):null,t[31]=f,t[32]=h);let y;t[33]!==n.name||t[34]!==n.scope||t[35]!==c?(y=pt({skillName:n.name,scope:n.scope,workspace:c}),t[33]=n.name,t[34]=n.scope,t[35]=c,t[36]=y):y=t[36];let C;t[37]!==u||t[38]!==l||t[39]!==y?(C=(0,Z.jsx)(Jt,{input:y,installStates:l,isElectronHost:d!=null,dispatch:u}),t[37]=u,t[38]=l,t[39]=y,t[40]=C):C=t[40];let w;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(me,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`zd00pH`})]}),t[41]=w):w=t[41];let T;t[42]!==f||t[43]!==m?(T=f?(0,Z.jsx)(g,{onSelect:()=>void m(f),children:(0,Z.jsx)(r,{id:`z2funE`})}):null,t[42]=f,t[43]=m,t[44]=T):T=t[44];let E;t[45]!==m||t[46]!==n.path?(E=()=>void m(n.path),t[45]=m,t[46]=n.path,t[47]=E):E=t[47];let D;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(r,{id:`xloBjn`}),t[48]=D):D=t[48];let O;t[49]===E?O=t[50]:(O=(0,Z.jsx)(g,{onSelect:E,children:D}),t[49]=E,t[50]=O);let k;t[51]!==T||t[52]!==O?(k=(0,Z.jsxs)(_,{children:[w,(0,Z.jsxs)(v,{children:[T,O]})]}),t[51]=T,t[52]=O,t[53]=k):k=t[53];let A;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(S,{}),t[54]=A):A=t[54];let j;t[55]!==a||t[56]!==o||t[57]!==n?(j=()=>void a.duplicate(n,o),t[55]=a,t[56]=o,t[57]=n,t[58]=j):j=t[58];let M,N;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(ce,{"aria-hidden":!0}),N=(0,Z.jsx)(r,{id:`euc6Ns`}),t[59]=M,t[60]=N):(M=t[59],N=t[60]);let P;t[61]===j?P=t[62]:(P=(0,Z.jsxs)(g,{onSelect:j,children:[M,N]}),t[61]=j,t[62]=P);let F;t[63]!==a||t[64]!==o||t[65]!==n?(F=()=>a.requestRename(n,o),t[63]=a,t[64]=o,t[65]=n,t[66]=F):F=t[66];let I,L;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Le,{"aria-hidden":!0}),L=(0,Z.jsx)(r,{id:`2wxgft`}),t[67]=I,t[68]=L):(I=t[67],L=t[68]);let R;t[69]===F?R=t[70]:(R=(0,Z.jsxs)(g,{onSelect:F,children:[I,L]}),t[69]=F,t[70]=R);let z;t[71]!==a||t[72]!==n?(z=n.updateAvailable?(0,Z.jsxs)(g,{onSelect:()=>a.requestUpdate(n),children:[(0,Z.jsx)(_e,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`6g2jsp`})]}):null,t[71]=a,t[72]=n,t[73]=z):z=t[73];let B;t[74]!==a||t[75]!==n?(B=n.installed?(0,Z.jsxs)(g,{onSelect:()=>void a.uninstall(n),children:[(0,Z.jsx)(Re,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`fo0VXg`})]}):(0,Z.jsxs)(g,{onSelect:()=>void a.install(n),children:[(0,Z.jsx)(Fe,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`TKQ7K-`})]}),t[74]=a,t[75]=n,t[76]=B):B=t[76];let V;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(S,{}),t[77]=V):V=t[77];let H;t[78]!==a||t[79]!==n?(H=()=>a.requestDelete(n),t[78]=a,t[79]=n,t[80]=H):H=t[80];let U,W;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(ye,{"aria-hidden":!0}),W=(0,Z.jsx)(r,{id:`cnGeoo`}),t[81]=U,t[82]=W):(U=t[81],W=t[82]);let G;t[83]===H?G=t[84]:(G=(0,Z.jsxs)(g,{variant:`destructive`,onSelect:H,children:[U,W]}),t[83]=H,t[84]=G);let K;return t[85]!==k||t[86]!==P||t[87]!==R||t[88]!==h||t[89]!==z||t[90]!==B||t[91]!==G||t[92]!==C?(K=(0,Z.jsxs)(Z.Fragment,{children:[h,C,k,A,P,R,z,B,V,G]}),t[85]=k,t[86]=P,t[87]=R,t[88]=h,t[89]=z,t[90]=B,t[91]=G,t[92]=C,t[93]=K):K=t[93],K}export{Fe as C,Ie as S,Dt as _,Jt as a,At as b,Gt as c,ut as d,ft as f,xt as g,pt as h,Yt as i,Vt as l,lt as m,ln as n,Kt as o,ct as p,rn as r,Wt as s,cn as t,mt as u,dt as v,st as x,Tt 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{t as o}from"./createLucideIcon-DAkhoPjT.js";import{t as s}from"./button-Gol9BgNB.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dialog-6-bc7qPg.js";import{a as g,d as _,f as v,i as y,o as b,p as x,u as S}from"./dropdown-menu-xw8WTdb-.js";import{t as C}from"./label-DyipnO5I.js";import{C as w,a as T,f as E,h as D,m as O,n as k,o as A,p as j,r as M,s as N,t as P}from"./agent-visibility-DJ6Bc0aU.js";import{An as F,Dn as I,Ei as L,En as R,Fn as z,Gt as B,Kt as V,Mn as H,Nn as U,On as W,Pn as G,Pt as K,Tn as q,Ut as J,an as ee,dt as te,fn as ne,ft as re,pn as ie,un as Y,z as ae}from"./dist-DJbbCXtB.js";import{t as oe}from"./RegisteredAgentIcon-CyQDojW_.js";import{a as se,d as ce,l as le,n as ue,r as de,t as fe,u as pe}from"./workspace-paths-CU85-ZRd.js";import{t as me}from"./copy-9EDFYcyR.js";import{t as he}from"./folder-open-wLd69QUc.js";import{t as ge}from"./loader-circle-Cg5SU7AZ.js";import{t as _e}from"./refresh-cw-DClG_qgN.js";import{t as ve}from"./sliders-horizontal-BNv-Koqw.js";import{t as ye}from"./trash-2-DE3a7L75.js";import{n as X}from"./dist-B8I5m7M1.js";import{t as be}from"./input-D4OPkja2.js";import{t as xe}from"./dist-BCZq3DKc.js";import{i as Se}from"./use-settings-route-BX1P2p9-.js";import{t as Ce}from"./parse-api-error-BtEL2kxi.js";import{c as we,l as Te}from"./documents-events-C-mYs64z.js";import{n as Ee}from"./config-context-D3FvmHZm.js";import{t as De}from"./use-workspace-DcPrrukl.js";import{n as Oe}from"./clipboard-adapter-ZCy01ehf.js";import{a as ke,d as Ae,f as je,n as Me,s as Ne,t as Pe}from"./skills-api-DWPhWBud.js";var Fe=o(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Ie=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Le=o(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Re=o(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=t(),Q=e(n(),1),$=a();function ze(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Be(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ce(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ve(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?ze(e):Be()}var He=`ok:skill:cowork:installed`,Ue=`1`,We=250,Ge=`/api/skill/install-state`;function Ke(e){return`${He}:v${e}`}var qe=new Map;async function Je(e={},t={}){let n=t.force?`__force__`:`__default__`,r=qe.get(n);if(r)return r;let i=Ye(e,t);return qe.set(n,i),i.finally(()=>{qe.get(n)===i&&qe.delete(n)}),i}async function Ye(e,t){let n=e.installer===void 0?Ve():e.installer,r=Xe(e.storage),i=e.fetchSnapshot??Qe,a=e.serverTimeoutMs??We,o=null;if(!t.force){try{o=await $e(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Ke(o?.currentVersion??e.fallbackSkillVersion??Ze());if(!t.force&&r?.getItem(s)===Ue)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Ue)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Xe(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ze(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Qe(){let e;try{e=await fetch(Ge,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function $e(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function et(e){return Je({},e)}function tt(){return Je({},{force:!0})}async function nt(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function rt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return nt({target:`claude-cowork`,url:Y({mode:`cowork`},e)},n);case`claude-code`:return nt({target:`claude-code`,url:Y({mode:`code`},e)},n);case`codex`:return nt({target:`codex`,url:ne(e)},n);case`cursor`:return nt({target:`cursor`,url:ie(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function it(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var at=`open-knowledge:agent-thread-launch`;function ot(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(at,{detail:e}))}function st(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(at,n),()=>t.removeEventListener(at,n)}function ct(e){if(!e.docName||!e.workspace)return null;let t=fe(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:ue(n,t,r)}}function lt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function ut(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function dt(e){return j(e.installUrl).then(()=>void 0)}function ft(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function pt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function mt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??fe(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:ue(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function ht(e){return`Opened in ${e}.`}function gt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function _t(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function vt(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function yt(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function bt(e,t,n,r){return e.compose?ee(yt(e.compose,t,n,r)):e.selection?H({...e.selection,target:t,transport:r}):e.skill?U(e.skill.name,e.skill.scope,n):e.ask?q(e.ask.relativePath,e.ask.instruction,n,t,r):L(e.docContext===null?e.folderRelativePath?F(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?I(n,e.instruction,r):R(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):W(e.docContext.relativePath,n,e.instruction,r))}function xt(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${te} ${bt(e,B[t].handoffTarget,!1,`terminal`)}`:G(e.docContext?.relativePath??null)}function St(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${re} ${bt(e,`claude-code`,!1,`terminal`)}`:z(e.docContext?.relativePath??null)}function Ct(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function wt(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function Tt(e,t){ot({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:St(e),docName:Ct(e),titleHint:wt(e)})}async function Et(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:bt(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=vt(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(ht(u));else{let i=_t(r),a=gt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Et(e,t,n,r+1)}}})}return a}function Dt(e){return O.find(t=>t.id===e)?.displayName??e}function Ot(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function kt(){return{dispatchHandoff:rt,recordHandoff:it,toast:{success:e=>{X.success(e)},error:(e,t)=>{X.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Ot(),getDisplayName:Dt,ensureCoworkSkillInstalled:et,autoOpen:!0}}function At(){let e=(0,$.c)(2),{merged:t}=Ee(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>Et(e,t,{...kt(),autoOpen:n}),reinstallCoworkSkill:tt},e[0]=n,e[1]=r),r}var jt=[...new Set(O.flatMap(e=>e.schemes))];function Mt(e,t){let n=t.now?.()??Date.now(),r={};for(let t of O){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Nt(e){return Mt({},e)}async function Pt(e){let t=e.schemes??jt,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Ft=Object.fromEntries(jt.map(e=>[e,{installed:!1}]));async function It(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Ft}if(!t.ok)return Ft;let n;try{n=await t.json()}catch{return Ft}if(typeof n!=`object`||!n||Array.isArray(n))return Ft;let r=n,i={};for(let e of jt)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Lt(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function Rt(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Nt({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Mt(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Lt(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function zt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Bt(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Pt({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>It({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Vt(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Ht),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Rt(Bt());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Ht(){return Nt({isElectronHost:zt(),now:Date.now})}var Ut=(0,Q.createContext)(null);function Wt(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Ut,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Gt(){return(0,Q.use)(Ut)}function Kt(e){let t=(0,$.c)(48),{itemName:n,isSubmitting:a,onDelete:o,customTitle:h,customDescription:g,customDetail:_,customConfirmLabel:v,customConfirmLabelBusy:y,children:b}=e,{_:x}=i(),S;t[0]!==x||t[1]!==n?(S=n??x({id:`L3CEC1`}),t[0]=x,t[1]=n,t[2]=S):S=t[2];let C=S,w;t[3]!==x||t[4]!==v?(w=v??x({id:`cnGeoo`}),t[3]=x,t[4]=v,t[5]=w):w=t[5];let T=w,E;t[6]!==x||t[7]!==v||t[8]!==y?(E=y??v??x({id:`s3caR3`}),t[6]=x,t[7]=v,t[8]=y,t[9]=E):E=t[9];let D=E,O;t[10]!==x||t[11]!==h||t[12]!==C?(O=h??x({id:`77SdEP`,values:{itemName:C}}),t[10]=x,t[11]=h,t[12]=C,t[13]=O):O=t[13];let k;t[14]===O?k=t[15]:(k=(0,Z.jsx)(l,{children:O}),t[14]=O,t[15]=k);let A;t[16]!==x||t[17]!==g||t[18]!==C?(A=g??x({id:`16D5Zj`,values:{itemName:C}}),t[16]=x,t[17]=g,t[18]=C,t[19]=A):A=t[19];let j;t[20]===A?j=t[21]:(j=(0,Z.jsx)(c,{className:`whitespace-pre-wrap`,children:A}),t[20]=A,t[21]=j);let M;t[22]===_?M=t[23]:(M=_?(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:_}):null,t[22]=_,t[23]=M);let N;t[24]!==k||t[25]!==j||t[26]!==M?(N=(0,Z.jsxs)(m,{children:[k,j,M]}),t[24]=k,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]===b?P=t[29]:(P=b?(0,Z.jsx)(d,{children:b}):null,t[28]=b,t[29]=P);let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(r,{id:`dEgA5A`}),t[30]=F):F=t[30];let I;t[31]===a?I=t[32]:(I=(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(s,{variant:`outline`,disabled:a,children:F})}),t[31]=a,t[32]=I);let L;t[33]!==T||t[34]!==D||t[35]!==a?(L=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ge,{className:`size-4 animate-spin`}),` `,D]}):T,t[33]=T,t[34]=D,t[35]=a,t[36]=L):L=t[36];let R;t[37]!==a||t[38]!==o||t[39]!==L?(R=(0,Z.jsx)(s,{variant:`destructive`,onClick:o,disabled:a,children:L}),t[37]=a,t[38]=o,t[39]=L,t[40]=R):R=t[40];let z;t[41]!==I||t[42]!==R?(z=(0,Z.jsxs)(f,{children:[I,R]}),t[41]=I,t[42]=R,t[43]=z):z=t[43];let B;return t[44]!==P||t[45]!==z||t[46]!==N?(B=(0,Z.jsxs)(u,{children:[N,P,z]}),t[44]=P,t[45]=z,t[46]=N,t[47]=B):B=t[47],B}function qt(e){return e?xe._({id:`wTcjov`}):null}function Jt(e){let t=(0,$.c)(47),{_:n}=i(),a=de(),o=Gt(),s=w(),c=E();if(a)return null;let{input:l,installStates:u,dispatch:d,onBeforeLaunch:f}=e,p=l===null,m,h,C,O,j,F,I,L,R,z,H;if(t[0]!==n||t[1]!==d||t[2]!==l||t[3]!==p||t[4]!==u||t[5]!==f||t[6]!==c||t[7]!==s||t[8]!==o){let e=qt(p),i;t[20]===c?i=t[21]:(i=e=>P(c,e.id),t[20]=c,t[21]=i);let a=D.filter(i),w;t[22]===c?w=t[23]:(w=e=>k(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=w);let E=s.filter(w),U=o?V.filter(e=>M(c,e,o.installedClis)):[];C=a.length>0,O=o!==null&&U.length>0,j=E.length>0,h=_,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(le,{"aria-hidden":`true`}),(0,Z.jsx)(r,{id:`O7_W_a`})]}),t[24]=H):H=t[24],m=v,F=`max-h-80`,I=j?(0,Z.jsxs)(y,{"aria-label":n({id:`vPKX2i`}),children:[(0,Z.jsxs)(b,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(r,{id:`RXEbZy`}),(0,Z.jsx)(N,{})]}),E.map(t=>{let i=t.name;return(0,Z.jsxs)(g,{onSelect:()=>{l!==null&&(f?.(),Tt(l,{agent:{source:t.source,id:t.id}}))},disabled:p,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:i,hint:e}}):void 0,children:[(0,Z.jsx)(oe,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(r,{id:`5PrrYw`,values:{agentName:i}})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==C||t[26]!==O||t[27]!==j?(L=j&&(O||C)?(0,Z.jsx)(S,{}):null,t[25]=C,t[26]=O,t[27]=j,t[28]=L):L=t[28],R=O?(0,Z.jsxs)(y,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(b,{children:(0,Z.jsx)(r,{id:`ALhMYW`})}),U.map(t=>{let{displayName:r}=B[t];return(0,Z.jsxs)(g,{onSelect:()=>{l!==null&&(f?.(),o.launchInTerminal(l,t))},disabled:p,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(A,{id:T(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,z=C?(0,Z.jsxs)(Z.Fragment,{children:[O?(0,Z.jsx)(S,{}):null,(0,Z.jsxs)(y,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(b,{children:(0,Z.jsx)(r,{id:`BBqGS9`})}),a.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(g,{disabled:!r,onSelect:()=>{if(l){if(f?.(),u[t.id]?.installed!==!0){dt(t);return}d(t.id,l)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(A,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=d,t[2]=l,t[3]=p,t[4]=u,t[5]=f,t[6]=c,t[7]=s,t[8]=o,t[9]=m,t[10]=h,t[11]=C,t[12]=O,t[13]=j,t[14]=F,t[15]=I,t[16]=L,t[17]=R,t[18]=z,t[19]=H}else m=t[9],h=t[10],C=t[11],O=t[12],j=t[13],F=t[14],I=t[15],L=t[16],R=t[17],z=t[18],H=t[19];let U;t[29]!==C||t[30]!==O||t[31]!==j?(U=j||O||C?(0,Z.jsx)(S,{}):null,t[29]=C,t[30]=O,t[31]=j,t[32]=U):U=t[32];let W;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(ve,{"aria-hidden":`true`}),t[33]=W):W=t[33];let G;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsxs)(g,{onSelect:Se,"data-testid":`file-tree-open-in-settings`,children:[W,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(r,{id:`jRAGrQ`})})]}),t[34]=G):G=t[34];let K;t[35]!==m||t[36]!==F||t[37]!==I||t[38]!==L||t[39]!==R||t[40]!==z||t[41]!==U?(K=(0,Z.jsxs)(m,{className:F,children:[I,L,R,z,U,G]}),t[35]=m,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z,t[41]=U,t[42]=K):K=t[42];let q;return t[43]!==h||t[44]!==H||t[45]!==K?(q=(0,Z.jsxs)(h,{children:[H,K]}),t[43]=h,t[44]=H,t[45]=K,t[46]=q):q=t[46],q}function Yt(e){let t=(0,$.c)(8),n=e?.enabled??!0,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`idle`},t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(0),c,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=()=>s($t),t=Te(e),n=we(t=>{t.includes(`files`)&&e()});return()=>{t(),n()}},l=[],t[1]=c,t[2]=l):(c=t[1],l=t[2]),(0,Q.useEffect)(c,l);let u;t[3]===n?u=t[4]:(u=()=>{if(!n)return;let e=!1;return a(Qt),fetch(`/api/skills`).then(Xt).then(t=>{if(e)return;let n=J.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skills response failed schema validation:`,n.error.issues),a({status:`error`,message:`Server returned an incomplete skills response.`});return}a({status:`ready`,data:n.data.skills})}).catch(t=>{e||a({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},t[3]=n,t[4]=u);let d;return t[5]!==n||t[6]!==o?(d=[o,n],t[5]=n,t[6]=o,t[7]=d):d=t[7],(0,Q.useEffect)(u,d),i}async function Xt(e){if(!e.ok){let t=await e.json().catch(Zt);throw Error(Ce(t)??`HTTP ${e.status}`)}return e.json()}function Zt(){return null}function Qt(e){return e.status===`ready`?e:{status:`loading`}}function $t(e){return e+1}function en(e){let t=(0,$.c)(16),{skill:n,onOpenChange:r,onDeleted:a}=e,{_:o}=i(),[s,c]=(0,Q.useState)(!1),l;t[0]!==o||t[1]!==a||t[2]!==r?(l=async function(e){c(!0);let t=await Pe(e.scope,e.name);if(c(!1),!t.ok){let{error:e}=t;X.error(o({id:`AtBdnD`,values:{error:e}}));return}X.success(o({id:`h9QFb9`,values:{0:e.name}})),a(),r(!1)},t[0]=o,t[1]=a,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==s||t[5]!==r?(f=e=>{!e&&!s&&r(!1)},t[4]=s,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==n?(p=n?(0,Z.jsx)(Kt,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:s,onDelete:()=>u(n),customDescription:o({id:`E1Da_b`,values:{0:n.path}})}):null,t[7]=o,t[8]=s,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,Z.jsx)(h,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function tn(e){let t=(0,$.c)(68),{skill:n,existingNames:a,onOpenChange:o,onRenamed:d}=e,{_:p}=i(),g=n!==null,_=(0,Q.useId)(),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(!1),S;t[0]===n?S=t[1]:(S=()=>{n&&y(n.name)},t[0]=n,t[1]=S);let w=n?.scope,T=n?.name,E;if(t[2]!==w||t[3]!==T?(E=[w,T],t[2]=w,t[3]=T,t[4]=E):E=t[4],(0,Q.useEffect)(S,E),!n)return null;let D,O,k,A;t[5]!==a||t[6]!==v||t[7]!==n.name?(k=v.trim(),A=k===n.name,D=k===``||!K.test(k),O=!D&&!A&&a.has(k),t[5]=a,t[6]=v,t[7]=n.name,t[8]=D,t[9]=O,t[10]=k,t[11]=A):(D=t[8],O=t[9],k=t[10],A=t[11]);let j=O,M=!D&&!j&&!A&&!b,N;t[12]!==p||t[13]!==M||t[14]!==o||t[15]!==d||t[16]!==n||t[17]!==k?(N=async function(){if(!n||!M)return;x(!0);let e=await Ne({scope:n.scope,fromName:n.name,toName:k});if(x(!1),!e.ok){X.error(p({id:`zKxoPm`,values:{0:n.name,1:e.error}}));return}X.success(p({id:`dUCQo4`,values:{trimmed:k}})),d?.(k),o(!1)},t[12]=p,t[13]=M,t[14]=o,t[15]=d,t[16]=n,t[17]=k,t[18]=N):N=t[18];let P=N,F;t[19]===o?F=t[20]:(F=e=>e?null:o(!1),t[19]=o,t[20]=F);let I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(l,{children:(0,Z.jsx)(r,{id:`dw_3cv`})}),t[21]=I):I=t[21];let L;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsxs)(m,{children:[I,(0,Z.jsx)(c,{children:(0,Z.jsx)(r,{id:`R9IDFz`})})]}),t[22]=L):L=t[22];let R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(r,{id:`6YtxFj`}),t[23]=R):R=t[23];let z;t[24]===_?z=t[25]:(z=(0,Z.jsx)(C,{htmlFor:_,children:R}),t[24]=_,t[25]=z);let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>y(e.target.value),t[26]=B):B=t[26];let V;t[27]===P?V=t[28]:(V=e=>{e.key===`Enter`&&P()},t[27]=P,t[28]=V);let H=D||j,U=D&&k!==``||j?`${_}-error`:void 0,W;t[29]!==_||t[30]!==v||t[31]!==V||t[32]!==H||t[33]!==U?(W=(0,Z.jsx)(be,{id:_,value:v,onChange:B,onKeyDown:V,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":H,"aria-describedby":U,className:`font-mono`}),t[29]=_,t[30]=v,t[31]=V,t[32]=H,t[33]=U,t[34]=W):W=t[34];let G;t[35]!==j||t[36]!==_||t[37]!==D||t[38]!==k?(G=D&&k!==``?(0,Z.jsx)(`p`,{id:`${_}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(r,{id:`A50vr3`,components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}})}):j?(0,Z.jsx)(`p`,{id:`${_}-error`,className:`text-xs text-destructive`,children:(0,Z.jsx)(r,{id:`YJ1BTp`})}):null,t[35]=j,t[36]=_,t[37]=D,t[38]=k,t[39]=G):G=t[39];let q;t[40]!==z||t[41]!==W||t[42]!==G?(q=(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[z,W,G]}),t[40]=z,t[41]=W,t[42]=G,t[43]=q):q=t[43];let J;t[44]===o?J=t[45]:(J=()=>o(!1),t[44]=o,t[45]=J);let ee;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(r,{id:`dEgA5A`}),t[46]=ee):ee=t[46];let te;t[47]!==b||t[48]!==J?(te=(0,Z.jsx)(s,{variant:`ghost`,onClick:J,disabled:b,children:ee}),t[47]=b,t[48]=J,t[49]=te):te=t[49];let ne;t[50]===P?ne=t[51]:(ne=()=>void P(),t[50]=P,t[51]=ne);let re=!M,ie;t[52]===b?ie=t[53]:(ie=b?(0,Z.jsx)(r,{id:`tHKQ6j`}):(0,Z.jsx)(r,{id:`2wxgft`}),t[52]=b,t[53]=ie);let Y;t[54]!==ne||t[55]!==re||t[56]!==ie?(Y=(0,Z.jsx)(s,{onClick:ne,disabled:re,children:ie}),t[54]=ne,t[55]=re,t[56]=ie,t[57]=Y):Y=t[57];let ae;t[58]!==te||t[59]!==Y?(ae=(0,Z.jsxs)(f,{children:[te,Y]}),t[58]=te,t[59]=Y,t[60]=ae):ae=t[60];let oe;t[61]!==q||t[62]!==ae?(oe=(0,Z.jsxs)(u,{children:[L,q,ae]}),t[61]=q,t[62]=ae,t[63]=oe):oe=t[63];let se;return t[64]!==g||t[65]!==oe||t[66]!==F?(se=(0,Z.jsx)(h,{open:g,onOpenChange:F,children:oe}),t[64]=g,t[65]=oe,t[66]=F,t[67]=se):se=t[67],se}function nn(e){let t=(0,$.c)(15),{skill:n,onOpenChange:a,onUpdated:o}=e,{_:g}=i(),[_,v]=(0,Q.useState)(!1),y;t[0]!==g||t[1]!==a||t[2]!==o?(y=async function(e){v(!0);let t=await je({scope:e.scope,name:e.name});v(!1);let n=se(e.name);if(!t.ok){X.error(g({id:`FRqZ9v`,values:{0:t.error}}));return}X.success(t.checkpointRef?g({id:`My9uXI`,values:{0:t.version,display:n}}):g({id:`mPneVR`,values:{0:t.version,display:n}})),o(),a(!1)},t[0]=g,t[1]=a,t[2]=o,t[3]=y):y=t[3];let b=y,x=n!==null,S;t[4]!==a||t[5]!==_?(S=e=>{!e&&!_&&a(!1)},t[4]=a,t[5]=_,t[6]=S):S=t[6];let C;t[7]!==b||t[8]!==n||t[9]!==_?(C=n?(0,Z.jsxs)(u,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(m,{children:[(0,Z.jsx)(l,{children:(0,Z.jsx)(r,{id:`iAoh55`,values:{0:se(n.name)}})}),(0,Z.jsx)(c,{children:n.installedVersion?(0,Z.jsx)(r,{id:`47EXvY`,values:{0:n.bundledVersion??``,1:n.installedVersion}}):(0,Z.jsx)(r,{id:`nD7Fx9`,values:{0:n.bundledVersion??``}})})]}),(0,Z.jsx)(d,{}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsx)(s,{variant:`outline`,disabled:_,children:(0,Z.jsx)(r,{id:`dEgA5A`})})}),(0,Z.jsx)(s,{onClick:()=>void b(n),disabled:_,children:_?(0,Z.jsx)(r,{id:`JL3si7`}):(0,Z.jsx)(r,{id:`EkH9pt`})})]})]}):null,t[7]=b,t[8]=n,t[9]=_,t[10]=C):C=t[10];let w;return t[11]!==x||t[12]!==S||t[13]!==C?(w=(0,Z.jsx)(h,{open:x,onOpenChange:S,children:C}),t[11]=x,t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function rn(){let e=(0,$.c)(30),{_:t}=i(),[n,r]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),d;e[0]===t?d=e[1]:(d=async function(e,n){u(e.name);let r=await ke({scope:e.scope,name:e.name,...n?{targets:[...n]}:{}});if(u(null),!r.ok)return X.error(t({id:`Mj8R8K`,values:{0:r.error}})),r;let i=an,a=new Set(r.hosts),o=r.hosts.filter(t=>!e.hosts.includes(t)),s=e.hosts.filter(e=>!a.has(e)),c=e=>{let t=r.warningCodes.indexOf(e);return t>=0?r.warnings[t]:void 0},l=c(`no-targets`);if(l)return X.warning(l),r;if(o.length>0){let e=c(`scripts-present`);e&&X.warning(e)}return r.hosts.length===0?X.success(t({id:`0LBDjY`,values:{0:e.name}})):o.length>0&&s.length===0?X.success(t({id:`PPFQ3o`,values:{0:e.name,1:i(o)}})):s.length>0&&o.length===0?X.success(t({id:`OOIVJo`,values:{0:e.name,1:i(s)}})):o.length>0&&s.length>0?X.success(t({id:`OxplNM`,values:{0:e.name,1:i(o),2:i(s)}})):X.success(t({id:`wDgmsr`,values:{0:e.name,1:i(r.hosts)}})),r},e[0]=t,e[1]=d);let f=d,p;e[2]===t?p=e[3]:(p=async function(e){u(e.name);let n=await Ae({scope:e.scope,name:e.name});return u(null),n.ok?X.success(t({id:`0LBDjY`,values:{0:e.name}})):X.error(t({id:`nJq7et`,values:{0:n.error}})),n},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=async function(e,n){let r=await Me({scope:e.scope,name:e.name,existingNames:n});if(!r.ok){X.error(t({id:`UPjaXD`,values:{0:e.name,1:r.error}}));return}X.success(t({id:`0g7rCZ`,values:{0:r.name}}))},e[4]=t,e[5]=h);let g=h,_,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{e||r(null)},v=()=>r(null),e[6]=_,e[7]=v):(_=e[6],v=e[7]);let y;e[8]===n?y=e[9]:(y=(0,Z.jsx)(en,{skill:n,onOpenChange:_,onDeleted:v}),e[8]=n,e[9]=y);let b=a?.skill??null,x=a?.existingNames??sn,S,C;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e||o(null)},C=()=>o(null),e[10]=S,e[11]=C):(S=e[10],C=e[11]);let w;e[12]!==b||e[13]!==x?(w=(0,Z.jsx)(tn,{skill:b,existingNames:x,onOpenChange:S,onRenamed:C}),e[12]=b,e[13]=x,e[14]=w):w=e[14];let T,E;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||c(null)},E=()=>c(null),e[15]=T,e[16]=E):(T=e[15],E=e[16]);let D;e[17]===s?D=e[18]:(D=(0,Z.jsx)(nn,{skill:s,onOpenChange:T,onUpdated:E}),e[17]=s,e[18]=D);let O;e[19]!==w||e[20]!==D||e[21]!==y?(O=(0,Z.jsxs)(Z.Fragment,{children:[y,w,D]}),e[19]=w,e[20]=D,e[21]=y,e[22]=O):O=e[22];let k=O,A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(e,t)=>o({skill:e,existingNames:t}),e[23]=A):A=e[23];let j;return e[24]!==k||e[25]!==g||e[26]!==f||e[27]!==l||e[28]!==m?(j={installingName:l,install:f,uninstall:m,duplicate:g,requestDelete:r,requestRename:A,requestUpdate:c,dialogs:k},e[24]=k,e[25]=g,e[26]=f,e[27]=l,e[28]=m,e[29]=j):j=e[29],j}function an(e){return e.map(on).join(`, `)}function on(e){return ae[e]??e}var sn=new Set;function cn(e){let t=(0,$.c)(19),{skill:n,onEdit:i,onInstall:a,onUninstall:o,onDelete:s}=e,c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(pe,{"aria-hidden":!0}),l=(0,Z.jsx)(r,{id:`ePK91l`}),t[0]=c,t[1]=l):(c=t[0],l=t[1]);let u;t[2]===i?u=t[3]:(u=(0,Z.jsxs)(g,{onSelect:i,children:[c,l]}),t[2]=i,t[3]=u);let d;t[4]!==a||t[5]!==n.installed?(d=a&&!n.installed?(0,Z.jsxs)(g,{onSelect:a,children:[(0,Z.jsx)(Fe,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`TKQ7K-`})]}):null,t[4]=a,t[5]=n.installed,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.installed?(f=n.installed?(0,Z.jsxs)(g,{onSelect:o,children:[(0,Z.jsx)(Re,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`fo0VXg`})]}):null,t[7]=o,t[8]=n.installed,t[9]=f):f=t[9];let p,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(ye,{"aria-hidden":!0}),m=(0,Z.jsx)(r,{id:`cnGeoo`}),t[10]=p,t[11]=m):(p=t[10],m=t[11]);let h;t[12]===s?h=t[13]:(h=(0,Z.jsxs)(g,{variant:`destructive`,onSelect:s,children:[p,m]}),t[12]=s,t[13]=h);let _;return t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==h?(_=(0,Z.jsxs)(Z.Fragment,{children:[u,d,f,h]}),t[14]=u,t[15]=d,t[16]=f,t[17]=h,t[18]=_):_=t[18],_}function ln(e){let t=(0,$.c)(94),{skill:n,actions:a,existingNames:o}=e,{_:s}=i(),c=De(),l=Vt().states,{dispatch:u}=At(),d=typeof window<`u`?window.okDesktop:void 0,f=n.absolutePath,p;t[0]===s?p=t[1]:(p=async function(e){try{await Oe(e),X.success(s({id:`SXCSQd`}))}catch{X.error(s({id:`cRHuuI`}))}},t[0]=s,t[1]=p);let m=p;if(n.managed){let e,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(b,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,Z.jsx)(Ie,{className:`size-3`,"aria-hidden":!0}),(0,Z.jsx)(r,{id:`VITWk5`})]}),i=(0,Z.jsx)(S,{}),t[2]=e,t[3]=i):(e=t[2],i=t[3]);let a;t[4]===f?a=t[5]:(a=d&&f?(0,Z.jsxs)(g,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,Z.jsx)(he,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`LtSYdi`})]}):null,t[4]=f,t[5]=a);let o;t[6]!==n.name||t[7]!==n.scope||t[8]!==c?(o=pt({skillName:n.name,scope:n.scope,workspace:c}),t[6]=n.name,t[7]=n.scope,t[8]=c,t[9]=o):o=t[9];let s;t[10]!==u||t[11]!==l||t[12]!==o?(s=(0,Z.jsx)(Jt,{input:o,installStates:l,isElectronHost:d!=null,dispatch:u}),t[10]=u,t[11]=l,t[12]=o,t[13]=s):s=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(me,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`zd00pH`})]}),t[14]=p):p=t[14];let h;t[15]!==f||t[16]!==m?(h=f?(0,Z.jsx)(g,{onSelect:()=>void m(f),children:(0,Z.jsx)(r,{id:`z2funE`})}):null,t[15]=f,t[16]=m,t[17]=h):h=t[17];let y;t[18]!==m||t[19]!==n.path?(y=()=>void m(n.path),t[18]=m,t[19]=n.path,t[20]=y):y=t[20];let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(r,{id:`xloBjn`}),t[21]=C):C=t[21];let w;t[22]===y?w=t[23]:(w=(0,Z.jsx)(g,{onSelect:y,children:C}),t[22]=y,t[23]=w);let T;t[24]!==w||t[25]!==h?(T=(0,Z.jsxs)(_,{children:[p,(0,Z.jsxs)(v,{children:[h,w]})]}),t[24]=w,t[25]=h,t[26]=T):T=t[26];let E;return t[27]!==T||t[28]!==a||t[29]!==s?(E=(0,Z.jsxs)(Z.Fragment,{children:[e,i,a,s,T]}),t[27]=T,t[28]=a,t[29]=s,t[30]=E):E=t[30],E}let h;t[31]===f?h=t[32]:(h=d&&f?(0,Z.jsxs)(g,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,Z.jsx)(he,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`LtSYdi`})]}):null,t[31]=f,t[32]=h);let y;t[33]!==n.name||t[34]!==n.scope||t[35]!==c?(y=pt({skillName:n.name,scope:n.scope,workspace:c}),t[33]=n.name,t[34]=n.scope,t[35]=c,t[36]=y):y=t[36];let C;t[37]!==u||t[38]!==l||t[39]!==y?(C=(0,Z.jsx)(Jt,{input:y,installStates:l,isElectronHost:d!=null,dispatch:u}),t[37]=u,t[38]=l,t[39]=y,t[40]=C):C=t[40];let w;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(x,{children:[(0,Z.jsx)(me,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`zd00pH`})]}),t[41]=w):w=t[41];let T;t[42]!==f||t[43]!==m?(T=f?(0,Z.jsx)(g,{onSelect:()=>void m(f),children:(0,Z.jsx)(r,{id:`z2funE`})}):null,t[42]=f,t[43]=m,t[44]=T):T=t[44];let E;t[45]!==m||t[46]!==n.path?(E=()=>void m(n.path),t[45]=m,t[46]=n.path,t[47]=E):E=t[47];let D;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(r,{id:`xloBjn`}),t[48]=D):D=t[48];let O;t[49]===E?O=t[50]:(O=(0,Z.jsx)(g,{onSelect:E,children:D}),t[49]=E,t[50]=O);let k;t[51]!==T||t[52]!==O?(k=(0,Z.jsxs)(_,{children:[w,(0,Z.jsxs)(v,{children:[T,O]})]}),t[51]=T,t[52]=O,t[53]=k):k=t[53];let A;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(S,{}),t[54]=A):A=t[54];let j;t[55]!==a||t[56]!==o||t[57]!==n?(j=()=>void a.duplicate(n,o),t[55]=a,t[56]=o,t[57]=n,t[58]=j):j=t[58];let M,N;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(ce,{"aria-hidden":!0}),N=(0,Z.jsx)(r,{id:`euc6Ns`}),t[59]=M,t[60]=N):(M=t[59],N=t[60]);let P;t[61]===j?P=t[62]:(P=(0,Z.jsxs)(g,{onSelect:j,children:[M,N]}),t[61]=j,t[62]=P);let F;t[63]!==a||t[64]!==o||t[65]!==n?(F=()=>a.requestRename(n,o),t[63]=a,t[64]=o,t[65]=n,t[66]=F):F=t[66];let I,L;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Le,{"aria-hidden":!0}),L=(0,Z.jsx)(r,{id:`2wxgft`}),t[67]=I,t[68]=L):(I=t[67],L=t[68]);let R;t[69]===F?R=t[70]:(R=(0,Z.jsxs)(g,{onSelect:F,children:[I,L]}),t[69]=F,t[70]=R);let z;t[71]!==a||t[72]!==n?(z=n.updateAvailable?(0,Z.jsxs)(g,{onSelect:()=>a.requestUpdate(n),children:[(0,Z.jsx)(_e,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`6g2jsp`})]}):null,t[71]=a,t[72]=n,t[73]=z):z=t[73];let B;t[74]!==a||t[75]!==n?(B=n.installed?(0,Z.jsxs)(g,{onSelect:()=>void a.uninstall(n),children:[(0,Z.jsx)(Re,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`fo0VXg`})]}):(0,Z.jsxs)(g,{onSelect:()=>void a.install(n),children:[(0,Z.jsx)(Fe,{"aria-hidden":!0}),(0,Z.jsx)(r,{id:`TKQ7K-`})]}),t[74]=a,t[75]=n,t[76]=B):B=t[76];let V;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(S,{}),t[77]=V):V=t[77];let H;t[78]!==a||t[79]!==n?(H=()=>a.requestDelete(n),t[78]=a,t[79]=n,t[80]=H):H=t[80];let U,W;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(ye,{"aria-hidden":!0}),W=(0,Z.jsx)(r,{id:`cnGeoo`}),t[81]=U,t[82]=W):(U=t[81],W=t[82]);let G;t[83]===H?G=t[84]:(G=(0,Z.jsxs)(g,{variant:`destructive`,onSelect:H,children:[U,W]}),t[83]=H,t[84]=G);let K;return t[85]!==k||t[86]!==P||t[87]!==R||t[88]!==h||t[89]!==z||t[90]!==B||t[91]!==G||t[92]!==C?(K=(0,Z.jsxs)(Z.Fragment,{children:[h,C,k,A,P,R,z,B,V,G]}),t[85]=k,t[86]=P,t[87]=R,t[88]=h,t[89]=z,t[90]=B,t[91]=G,t[92]=C,t[93]=K):K=t[93],K}export{Fe as C,Ie as S,Dt as _,Jt as a,At as b,Gt as c,ut as d,ft as f,xt as g,pt as h,Yt as i,Vt as l,lt as m,ln as n,Kt as o,ct as p,rn as r,Wt as s,cn as t,mt as u,dt as v,st as x,Tt as y};
@@ -1 +1 @@
1
- import{t as e}from"./parse-api-error-BtEL2kxi.js";import{i as t}from"./documents-events-DJXnk07Z.js";async function n(t){return e(await t.json().catch(()=>null))??`HTTP ${t.status}`}async function r(e){try{let r=await fetch(`/api/skill`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,created:i?.created??!1,warnings:i?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function i(e){try{let r=await fetch(`/api/skill-file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,created:i?.created??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function a(){try{let e=await fetch(`/api/skills/management`);return e.ok?await e.json():null}catch{return null}}async function o(e){try{return(await fetch(`/api/skills/management`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({manageEditorSkills:e})})).ok?(t(),!0):!1}catch{return!1}}function s(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let n=2;n<1e3;n+=1){let r=`${e}-copy-${n}`;if(!t.has(r))return r}return`${e}-copy-${t.size+1}`}async function c(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope}),i=await fetch(`/api/skill?${t.toString()}`);if(!i.ok)return{ok:!1,error:await n(i)};let a=await i.json().catch(()=>null),o=typeof a?.skill?.frontmatter?.description==`string`?a.skill.frontmatter.description:``,c=typeof a?.skill?.body==`string`?a.skill.body:``,l=s(e.name,e.existingNames),u=await r({scope:e.scope,name:l,frontmatter:{name:l,description:o},body:c});return u.ok?{ok:!0,name:l}:{ok:!1,error:u.error}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(e){let{name:a,fromScope:o,toScope:s}=e;if(o===s)return{ok:!0,scope:s};try{let e=await fetch(`/api/skill?name=${encodeURIComponent(a)}&scope=${o}`);if(!e.ok)return{ok:!1,error:await n(e)};let c=await e.json().catch(()=>null),l=typeof c?.skill?.frontmatter?.description==`string`?c.skill.frontmatter.description:``,u=typeof c?.skill?.body==`string`?c.skill.body:``,p=await fetch(`/api/skill?name=${encodeURIComponent(a)}&scope=${s}`);if(p.ok)return{ok:!1,error:`A ${s} skill named "${a}" already exists.`};if(p.status!==404)return{ok:!1,error:`Couldn't verify the ${s} destination "${a}" is free (HTTP ${p.status}); aborting before any write so an existing skill can't be overwritten. Retry in a moment.`};let m=await r({scope:s,name:a,frontmatter:{name:a,description:l},body:u});if(!m.ok)return m;let h=await f(o,a);if(!h.ok)return{ok:!1,error:`Copied "${a}" to ${s}, but reading its bundle files failed (${h.error}); the ${o} original is intact. Delete the partial ${s} copy and retry.`};let g=[];for(let e of h.files){if(e.text===null){g.push(e.path);continue}let t=await i({scope:s,name:a,path:e.path,content:e.text});if(!t.ok)return{ok:!1,error:`Copied "${a}" to ${s}, but copying its bundle file "${e.path}" failed (${t.error}); the ${o} original is intact. Delete the partial ${s} copy and retry.`}}let _=await d(o,a);return _.ok?(t(),{ok:!0,scope:s,...g.length>0?{skippedBinaryFiles:g}:{}}):{ok:!1,error:`Copied to ${s}, but couldn't remove the ${o} copy: ${_.error}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function u(e){try{let r=await fetch(`/api/skill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,committed:i?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function d(e,r){try{let i=`?name=${encodeURIComponent(r)}&scope=${encodeURIComponent(e)}`,a=await fetch(`/api/skill${i}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await n(a)};let o=await a.json().catch(()=>null);return t(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function f(e,t){try{let r=new URLSearchParams({name:t,scope:e}),i=await fetch(`/api/skill?${r.toString()}`);return i.ok?{ok:!0,files:(await i.json().catch(()=>null))?.skill?.files??[]}:{ok:!1,error:await n(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function p(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope,path:e.path}),r=await fetch(`/api/skill-file?${t.toString()}`,{signal:e.signal});if(!r.ok)return{ok:!1,status:r.status,error:await n(r)};let i=await r.json().catch(()=>null);return typeof i?.text==`string`?{ok:!0,text:i.text}:{ok:!1,status:r.status,error:`HTTP ${r.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function m(e,t){return p({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function h(e){try{let r=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,hosts:i?.hosts??[],scripts:i?.scripts??!1,warnings:i?.warnings??[],warningCodes:i?.warningCodes??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function g(e){try{let r=await fetch(`/api/skill/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,uninstalled:i?.uninstalled??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function _(e){try{let r=await fetch(`/api/skill/update`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,version:i?.version??``,previousVersion:i?.previousVersion,checkpointRef:i?.checkpointRef}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{h as a,l as c,g as d,_ as f,a as i,r as l,c as n,m as o,f as r,u as s,d as t,o as u};
1
+ import{t as e}from"./parse-api-error-BtEL2kxi.js";import{i as t}from"./documents-events-C-mYs64z.js";async function n(t){return e(await t.json().catch(()=>null))??`HTTP ${t.status}`}async function r(e){try{let r=await fetch(`/api/skill`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,created:i?.created??!1,warnings:i?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function i(e){try{let r=await fetch(`/api/skill-file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,created:i?.created??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function a(){try{let e=await fetch(`/api/skills/management`);return e.ok?await e.json():null}catch{return null}}async function o(e){try{return(await fetch(`/api/skills/management`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({manageEditorSkills:e})})).ok?(t(),!0):!1}catch{return!1}}function s(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let n=2;n<1e3;n+=1){let r=`${e}-copy-${n}`;if(!t.has(r))return r}return`${e}-copy-${t.size+1}`}async function c(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope}),i=await fetch(`/api/skill?${t.toString()}`);if(!i.ok)return{ok:!1,error:await n(i)};let a=await i.json().catch(()=>null),o=typeof a?.skill?.frontmatter?.description==`string`?a.skill.frontmatter.description:``,c=typeof a?.skill?.body==`string`?a.skill.body:``,l=s(e.name,e.existingNames),u=await r({scope:e.scope,name:l,frontmatter:{name:l,description:o},body:c});return u.ok?{ok:!0,name:l}:{ok:!1,error:u.error}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(e){let{name:a,fromScope:o,toScope:s}=e;if(o===s)return{ok:!0,scope:s};try{let e=await fetch(`/api/skill?name=${encodeURIComponent(a)}&scope=${o}`);if(!e.ok)return{ok:!1,error:await n(e)};let c=await e.json().catch(()=>null),l=typeof c?.skill?.frontmatter?.description==`string`?c.skill.frontmatter.description:``,u=typeof c?.skill?.body==`string`?c.skill.body:``,p=await fetch(`/api/skill?name=${encodeURIComponent(a)}&scope=${s}`);if(p.ok)return{ok:!1,error:`A ${s} skill named "${a}" already exists.`};if(p.status!==404)return{ok:!1,error:`Couldn't verify the ${s} destination "${a}" is free (HTTP ${p.status}); aborting before any write so an existing skill can't be overwritten. Retry in a moment.`};let m=await r({scope:s,name:a,frontmatter:{name:a,description:l},body:u});if(!m.ok)return m;let h=await f(o,a);if(!h.ok)return{ok:!1,error:`Copied "${a}" to ${s}, but reading its bundle files failed (${h.error}); the ${o} original is intact. Delete the partial ${s} copy and retry.`};let g=[];for(let e of h.files){if(e.text===null){g.push(e.path);continue}let t=await i({scope:s,name:a,path:e.path,content:e.text});if(!t.ok)return{ok:!1,error:`Copied "${a}" to ${s}, but copying its bundle file "${e.path}" failed (${t.error}); the ${o} original is intact. Delete the partial ${s} copy and retry.`}}let _=await d(o,a);return _.ok?(t(),{ok:!0,scope:s,...g.length>0?{skippedBinaryFiles:g}:{}}):{ok:!1,error:`Copied to ${s}, but couldn't remove the ${o} copy: ${_.error}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function u(e){try{let r=await fetch(`/api/skill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,committed:i?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function d(e,r){try{let i=`?name=${encodeURIComponent(r)}&scope=${encodeURIComponent(e)}`,a=await fetch(`/api/skill${i}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await n(a)};let o=await a.json().catch(()=>null);return t(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function f(e,t){try{let r=new URLSearchParams({name:t,scope:e}),i=await fetch(`/api/skill?${r.toString()}`);return i.ok?{ok:!0,files:(await i.json().catch(()=>null))?.skill?.files??[]}:{ok:!1,error:await n(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function p(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope,path:e.path}),r=await fetch(`/api/skill-file?${t.toString()}`,{signal:e.signal});if(!r.ok)return{ok:!1,status:r.status,error:await n(r)};let i=await r.json().catch(()=>null);return typeof i?.text==`string`?{ok:!0,text:i.text}:{ok:!1,status:r.status,error:`HTTP ${r.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function m(e,t){return p({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function h(e){try{let r=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,hosts:i?.hosts??[],scripts:i?.scripts??!1,warnings:i?.warnings??[],warningCodes:i?.warningCodes??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function g(e){try{let r=await fetch(`/api/skill/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,uninstalled:i?.uninstalled??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function _(e){try{let r=await fetch(`/api/skill/update`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!r.ok)return{ok:!1,error:await n(r)};let i=await r.json().catch(()=>null);return t(),{ok:!0,version:i?.version??``,previousVersion:i?.previousVersion,checkpointRef:i?.checkpointRef}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{h as a,l as c,g as d,_ as f,a as i,r as l,c as n,m as o,f as r,u as s,d as t,o as u};
@@ -1,2 +1,2 @@
1
- import{H as e}from"./CodeMirrorPropInput-CyIlgGaP.js";import{$ as t,B as n,C as r,N as i,S as a,V as o,et as s,f as c,v as l,y as u,z as d}from"./config-provider-CedEU5Ch.js";import{$ as f,Dt as p,J as m,Mt as h,Q as g,St as _,X as v,kt as y}from"./dist-D7mv9smG.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:i(this.yanchor),yhead:i(this.yhead)}}static fromJSON(t){return new e(a(t.yanchor),a(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new c(e)}toYPos(e,t=0){return r(this.ytext,e,t)}fromYPos(e){let t=u(a(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new b(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?p.cursor(n.pos,n.assoc):p.range(t.pos,n.pos)}},S=y.define({combine(e){return e[e.length-1]}}),C=_.define(),w=class{constructor(e){this.view=e,this.conf=e.state.facet(S),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[C.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(C)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
1
+ import{H as e}from"./CodeMirrorPropInput-DOcEkWLX.js";import{$ as t,B as n,C as r,N as i,S as a,V as o,et as s,f as c,v as l,y as u,z as d}from"./config-provider-B9kQH9zn.js";import{$ as f,Dt as p,J as m,Mt as h,Q as g,St as _,X as v,kt as y}from"./dist-D7mv9smG.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:i(this.yanchor),yhead:i(this.yhead)}}static fromJSON(t){return new e(a(t.yanchor),a(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new c(e)}toYPos(e,t=0){return r(this.ytext,e,t)}fromYPos(e){let t=u(a(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new b(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?p.cursor(n.pos,n.assoc):p.range(t.pos,n.pos)}},S=y.define({combine(e){return e[e.length-1]}}),C=_.define(),w=class{constructor(e){this.view=e,this.conf=e.state.facet(S),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[C.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(C)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
2
2
  `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},T=g.fromClass(w),E=v.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),D=_.define(),O=class extends f{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return d(`span`,[o(`class`,`cm-ySelectionCaret`),o(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[n(`⁠`),d(`div`,[o(`class`,`cm-ySelectionCaretDot`)]),n(`⁠`),d(`div`,[o(`class`,`cm-ySelectionInfo`)],[n(this.name)]),n(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},k=class{constructor(e){this.conf=e.state.facet(S),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[D.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=h.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let n=this.conf.ytext,i=n.doc,o=this.conf.awareness,c=[],d=this.conf.awareness.getLocalState();if(d!=null){let t=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=t?e.state.selection.main:null,s=d.cursor==null?null:a(d.cursor.anchor),c=d.cursor==null?null:a(d.cursor.head);if(i!=null){let e=r(n,i.anchor),t=r(n,i.head);(d.cursor==null||!l(s,e)||!l(c,t))&&o.setLocalStateField(`cursor`,{anchor:e,head:t})}else d.cursor!=null&&t&&o.setLocalStateField(`cursor`,null)}o.getStates().forEach((r,a)=>{if(a===o.doc.clientID)return;let l=r.cursor;if(l==null||l.anchor==null||l.head==null)return;let d=u(l.anchor,i),f=u(l.head,i);if(d==null||f==null||d.type!==n||f.type!==n)return;let{color:p=`#30bced`,name:h=`Anonymous`}=r.user||{},g=r.user&&r.user.colorLight||p+`33`,_=s(d.index,f.index),v=t(d.index,f.index),y=e.view.state.doc.lineAt(_),b=e.view.state.doc.lineAt(v);if(y.number===b.number)c.push({from:_,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});else{c.push({from:_,to:y.from+y.length,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})}),c.push({from:b.from,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});for(let t=y.number+1;t<b.number;t++){let n=e.view.state.doc.line(t).from;c.push({from:n,to:n,value:m.line({attributes:{style:`background-color: ${g}`,class:`cm-yLineSelection`}})})}}c.push({from:f.index,to:f.index,value:m.widget({side:f.index-d.index>0?-1:1,block:!1,widget:new O(p,h)})})}),this.decorations=m.set(c,!0)}},A=g.fromClass(k,{decorations:e=>e.decorations}),j=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},M=y.define({combine(e){return e[e.length-1]}});_.define();var N=class{constructor(t){this.view=t,this.conf=t.state.facet(M),this._undoManager=this.conf.undoManager,this.syncConf=t.state.facet(S),this._beforeChangeSelection=null,this._mux=e(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:e})=>{let n=e.meta.get(this);if(n){let e=this.syncConf.fromYRange(n);t.dispatch(t.state.update({selection:e,effects:[v.scrollIntoView(e)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(C)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},P=g.fromClass(N),F=({state:e,dispatch:t})=>e.facet(M).undo()||!0,I=({state:e,dispatch:t})=>e.facet(M).redo()||!0,L=[{key:`Mod-z`,run:F,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:I,preventDefault:!0},{key:`Mod-Shift-z`,run:I,preventDefault:!0}],R=(e,t,{undoManager:n=new c(e)}={})=>{let r=new x(e,t),i=[S.of(r),T];return t&&i.push(E,A),n!==!1&&i.push(M.of(new j(n)),P,v.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?F(t):e.inputType===`historyRedo`?I(t):!1}})),i};export{L as n,R as t};