@pi-chamber/web 1.0.6-rc.4 → 1.0.6-rc.6

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 (121) hide show
  1. package/dist/assets/{DiagramView-BZ--w7Lh.js → DiagramView-BxBfOrN5.js} +1 -1
  2. package/dist/assets/{DiffView-Dtn6otnT.js → DiffView-CSC9GMrb.js} +3 -3
  3. package/dist/assets/{FileSaveConflictDialog-p1ik30al.js → FileSaveConflictDialog-C_MNWp6w.js} +1 -1
  4. package/dist/assets/{FilesView-D0Z0VmQm.js → FilesView-DeN6KmNt.js} +4 -4
  5. package/dist/assets/{GitHubDetailScaffold-a27RksFo.js → GitHubDetailScaffold-CrtJwlqV.js} +2 -2
  6. package/dist/assets/{GitHubLinkPicker-B0CfzNfk.js → GitHubLinkPicker-g6w8K95J.js} +1 -1
  7. package/dist/assets/GitHubListPrimitives-lAi2ywE3.js +1 -0
  8. package/dist/assets/{GitView-BNkoaVYl.js → GitView-D9_em8Vx.js} +5 -5
  9. package/dist/assets/IssuesSurface-DCiHe6TE.js +7 -0
  10. package/dist/assets/{JsonTreeView-CEiJsFnP.js → JsonTreeView-D64mTfTx.js} +1 -1
  11. package/dist/assets/{MarkdownRendererImpl-418ChlsN.js → MarkdownRendererImpl-DwE90rTA.js} +3 -3
  12. package/dist/assets/PatchDiff-CcIwURzW.js +1 -0
  13. package/dist/assets/{PierreDiffViewer-CkuyY9ne.js → PierreDiffViewer-tN7awL0-.js} +2 -2
  14. package/dist/assets/PullRequestsSurface-iX4r3QlS.js +2 -0
  15. package/dist/assets/{SessionSwitcherContent-DkfjRgwv.js → SessionSwitcherContent-DrrM0ObM.js} +1 -1
  16. package/dist/assets/{SessionSwitcherDropdown-CEw8BEs6.js → SessionSwitcherDropdown-B9_0JwY7.js} +2 -2
  17. package/dist/assets/SessionUnreadDot-Bpgp2gLO.js +1 -0
  18. package/dist/assets/SettingsView-C4hec1iy.js +6 -0
  19. package/dist/assets/{SettingsWindow-D03Z9QyW.js → SettingsWindow-Bepcpy0R.js} +1 -1
  20. package/dist/assets/{StickyHorizontalScrollbar-CONTbZgX.js → StickyHorizontalScrollbar-DNsbTLS7.js} +1 -1
  21. package/dist/assets/{ToolOutputDialog-DibddNlz.js → ToolOutputDialog-Dl9-vpvL.js} +5 -5
  22. package/dist/assets/{ToolPartDiffPreview-Bx7T1M2f.js → ToolPartDiffPreview-CLlHEPYD.js} +1 -1
  23. package/dist/assets/{VirtualizedFileDiff-BY-mDMT8.js → VirtualizedFileDiff-D9OpUpR3.js} +4 -4
  24. package/dist/assets/{Virtualizer-cIf8dSOQ.js → Virtualizer-okhy9Aq3.js} +1 -1
  25. package/dist/assets/{collapsible-BhQdnj8G.js → collapsible-ZT74WYMA.js} +1 -1
  26. package/dist/assets/{computeVirtualFileMetrics-CzkFqhaU.js → computeVirtualFileMetrics-CDv_UBXL.js} +1 -1
  27. package/dist/assets/{contextFileOpenGuard-CjCOK8EB.js → contextFileOpenGuard-BJ2sAhZG.js} +1 -1
  28. package/dist/assets/{fileTreeStatus-CPTpyKOV.js → fileTreeStatus-B2PDFobt.js} +2 -2
  29. package/dist/assets/{gitStatusPredicates-_GNbGCCb.js → gitStatusPredicates-BDdOjxH_.js} +1 -1
  30. package/dist/assets/{githubLink-CwIFogWd.js → githubLink-wwC2_C_9.js} +2 -2
  31. package/dist/assets/index-BaLCg7tL.css +1 -0
  32. package/dist/assets/{index-DjOKW10B.js → index-MXKT8Ir9.js} +1 -1
  33. package/dist/assets/index-fmzQmSSv.js +11 -0
  34. package/dist/assets/{main-C51a3z3b.js → main-CnW7qm2b.js} +2 -2
  35. package/dist/assets/{main-1wmEZ4Is.js → main-DmHVgAh0.js} +4 -4
  36. package/dist/assets/{markdownCore-Dsr6dY5C.js → markdownCore-DOFhfL5i.js} +2 -2
  37. package/dist/assets/{miniChat-DCxCx1fF.js → miniChat-D_Wl2jlx.js} +2 -2
  38. package/dist/assets/{mobile-D6Ac2Mu3.js → mobile-Cl-KcfGW.js} +2 -2
  39. package/dist/assets/{nativeFileSave-P_Eg5Dgb.js → nativeFileSave-B4Rg6n8u.js} +1 -1
  40. package/dist/assets/{pi-session-focus-preference-DjDyjZ1C.js → pi-session-focus-preference-BqEU9Iq6.js} +3 -3
  41. package/dist/assets/{renderDiffWithHighlighter-CK_inhQE.js → renderDiffWithHighlighter-U7WjeGm9.js} +1 -1
  42. package/dist/assets/{renderElectronMiniChatApp-wBNgFl0U.js → renderElectronMiniChatApp-BJxNc9OP.js} +2 -2
  43. package/dist/assets/{renderFileWithHighlighter-B_PFeRW5.js → renderFileWithHighlighter-DiwpFgMp.js} +1 -1
  44. package/dist/assets/{renderMobileApp-B3mhxGnb.js → renderMobileApp-d5KpyvBc.js} +3 -3
  45. package/dist/assets/runtimeEndpointReset-Cd4yJDsk.js +62 -0
  46. package/dist/assets/{runtimeSurface-C3YPOBlg.js → runtimeSurface-X62LLBLv.js} +1 -1
  47. package/dist/assets/{useAppFontEffects-CoFst31H.js → useAppFontEffects-FKnY7Fe2.js} +92 -92
  48. package/dist/assets/useGitHubRemoteSearch-4QMXIODG.js +1 -0
  49. package/dist/assets/{useSwitcherItems-DHCCg4GF.js → useSwitcherItems-DtCNsq8u.js} +1 -1
  50. package/dist/assets/{vendor-aparajita-capacitor-secure-storage-B9_YeZyx.js → vendor-aparajita-capacitor-secure-storage-DVZvgYu4.js} +1 -1
  51. package/dist/assets/{vendor-base-ui-CKSCJw-4.js → vendor-base-ui-BCqPBzDj.js} +1 -1
  52. package/dist/assets/{vendor-boot-Ciu-Edvy.js → vendor-boot-3SaHYVb1.js} +1 -1
  53. package/dist/assets/{vendor-capacitor-app-Bpy_aPMq.js → vendor-capacitor-app-NbQ-WiPS.js} +1 -1
  54. package/dist/assets/{vendor-capacitor-keyboard-DO8AIjrZ.js → vendor-capacitor-keyboard-CgrHt8iN.js} +1 -1
  55. package/dist/assets/{vendor-capacitor-status-bar-SQkytwUW.js → vendor-capacitor-status-bar-CWt0OF5t.js} +1 -1
  56. package/dist/assets/{vendor-codemirror-autocomplete-CInQsE8a.js → vendor-codemirror-autocomplete-WThuuUAz.js} +1 -1
  57. package/dist/assets/{vendor-codemirror-lang-angular-QbsN3LGE.js → vendor-codemirror-lang-angular-BbLGCxF6.js} +1 -1
  58. package/dist/assets/{vendor-codemirror-lang-cpp-BT5U7lxV.js → vendor-codemirror-lang-cpp-Cceks-9O.js} +1 -1
  59. package/dist/assets/{vendor-codemirror-lang-css-dF-Dxbty.js → vendor-codemirror-lang-css-D1wpUg3Z.js} +1 -1
  60. package/dist/assets/{vendor-codemirror-lang-go-e4dp1bar.js → vendor-codemirror-lang-go-Cv0zXHHM.js} +1 -1
  61. package/dist/assets/{vendor-codemirror-lang-html-DKcbBVQ4.js → vendor-codemirror-lang-html-DbL8oT9H.js} +1 -1
  62. package/dist/assets/{vendor-codemirror-lang-java-CB2-FWv6.js → vendor-codemirror-lang-java-CNugenuC.js} +1 -1
  63. package/dist/assets/{vendor-codemirror-lang-javascript-B1zJk7xE.js → vendor-codemirror-lang-javascript-Bx_FIyZF.js} +1 -1
  64. package/dist/assets/{vendor-codemirror-lang-jinja-BsERjdSd.js → vendor-codemirror-lang-jinja-DDGjB3Zq.js} +1 -1
  65. package/dist/assets/{vendor-codemirror-lang-json-C0pZ0NhY.js → vendor-codemirror-lang-json-DIvqf9Pb.js} +1 -1
  66. package/dist/assets/{vendor-codemirror-lang-less-_N9HmR4h.js → vendor-codemirror-lang-less-D8r9dGG1.js} +1 -1
  67. package/dist/assets/{vendor-codemirror-lang-liquid-D02xJRCD.js → vendor-codemirror-lang-liquid-B24mguYi.js} +1 -1
  68. package/dist/assets/{vendor-codemirror-lang-markdown-_6ojeUuZ.js → vendor-codemirror-lang-markdown-v3yG2sbf.js} +1 -1
  69. package/dist/assets/{vendor-codemirror-lang-php-DguCnbJA.js → vendor-codemirror-lang-php-BcZGalqy.js} +1 -1
  70. package/dist/assets/{vendor-codemirror-lang-python-Byr5gw5f.js → vendor-codemirror-lang-python-b-JqEwQy.js} +1 -1
  71. package/dist/assets/{vendor-codemirror-lang-rust-DN6Wh0eK.js → vendor-codemirror-lang-rust-B1uZxDW-.js} +1 -1
  72. package/dist/assets/{vendor-codemirror-lang-sass-DOlEW7q1.js → vendor-codemirror-lang-sass-DqPrngKp.js} +1 -1
  73. package/dist/assets/{vendor-codemirror-lang-sql-BJzE9Dby.js → vendor-codemirror-lang-sql-UyCnpt-k.js} +1 -1
  74. package/dist/assets/{vendor-codemirror-lang-vue-DR8E-2nr.js → vendor-codemirror-lang-vue-xDwYkovV.js} +1 -1
  75. package/dist/assets/{vendor-codemirror-lang-wast-n6lcDH5S.js → vendor-codemirror-lang-wast-CF3169p_.js} +1 -1
  76. package/dist/assets/{vendor-codemirror-lang-xml-Cf2lmlmY.js → vendor-codemirror-lang-xml-FCtVhuOb.js} +1 -1
  77. package/dist/assets/{vendor-codemirror-lang-yaml-DSR_E0yh.js → vendor-codemirror-lang-yaml-g0sPmAnv.js} +1 -1
  78. package/dist/assets/{vendor-codemirror-language-data-CSid5JuX.js → vendor-codemirror-language-data-B03xgzP2.js} +2 -2
  79. package/dist/assets/{vendor-codemirror-search-8lY3lt6q.js → vendor-codemirror-search-Dw3Wpu15.js} +1 -1
  80. package/dist/assets/{vendor-lezer-cpp-DZYTDKiD.js → vendor-lezer-cpp-Cu3E-KUI.js} +1 -1
  81. package/dist/assets/{vendor-lezer-css-6qV4fYNQ.js → vendor-lezer-css-Cb8vp67u.js} +1 -1
  82. package/dist/assets/{vendor-lezer-go-BDi_Iblq.js → vendor-lezer-go-BTsIaOm7.js} +1 -1
  83. package/dist/assets/{vendor-lezer-html-BjqcY-oJ.js → vendor-lezer-html-UQMsUwj-.js} +1 -1
  84. package/dist/assets/{vendor-lezer-java-J2BXqz1h.js → vendor-lezer-java-BIWrFrAx.js} +1 -1
  85. package/dist/assets/{vendor-lezer-javascript-CiQ9F8yX.js → vendor-lezer-javascript-BH2Etgoy.js} +1 -1
  86. package/dist/assets/{vendor-lezer-json-BxN83KKR.js → vendor-lezer-json-CE-QUCwM.js} +1 -1
  87. package/dist/assets/{vendor-lezer-lr-BVsDua_K.js → vendor-lezer-lr-HY6Yc0Vr.js} +1 -1
  88. package/dist/assets/{vendor-lezer-markdown-BkMtRQ3X.js → vendor-lezer-markdown-xFL3Evwf.js} +1 -1
  89. package/dist/assets/{vendor-lezer-php-B3XqnXdP.js → vendor-lezer-php-Cr_mQGrG.js} +1 -1
  90. package/dist/assets/{vendor-lezer-python-D342CidI.js → vendor-lezer-python-BNRFWCb0.js} +1 -1
  91. package/dist/assets/{vendor-lezer-rust-Dbfg_4LA.js → vendor-lezer-rust-BvfOK5cU.js} +1 -1
  92. package/dist/assets/{vendor-lezer-sass-ClxPaFt1.js → vendor-lezer-sass-qoxiLisk.js} +1 -1
  93. package/dist/assets/{vendor-lezer-xml-I_S6FQ1u.js → vendor-lezer-xml--x8SSpqU.js} +1 -1
  94. package/dist/assets/{vendor-lezer-yaml-COA6HWLP.js → vendor-lezer-yaml-BDo1JaEr.js} +1 -1
  95. package/dist/assets/{vendor-replit-codemirror-vim-7IE2zVmx.js → vendor-replit-codemirror-vim-D1Fe7FiY.js} +1 -1
  96. package/dist/assets/{web-components-CzkvK_V5.js → web-components-D5QImbWv.js} +4 -4
  97. package/dist/index.html +4 -4
  98. package/dist/mini-chat.html +3 -3
  99. package/dist/mobile.html +3 -3
  100. package/package.json +1 -1
  101. package/server/lib/pi/archive-store.js +38 -10
  102. package/server/lib/pi/archive-store.test.js +10 -0
  103. package/server/lib/pi/routes.js +65 -18
  104. package/server/lib/pi/routes.test.js +189 -8
  105. package/server/lib/pi/session-daemon/DOCUMENTATION.md +5 -1
  106. package/server/lib/pi/session-daemon/session-daemon-engines.test.js +18 -0
  107. package/server/lib/pi/session-daemon/session-daemon.js +24 -1
  108. package/server/lib/pi/session-shelf-store.js +155 -84
  109. package/server/lib/pi/session-shelf-store.test.js +134 -33
  110. package/server/lib/pi/ui-settings-store.js +59 -0
  111. package/server/lib/pi/ui-settings-store.test.js +105 -6
  112. package/dist/assets/GitHubListPrimitives-LFdR70l6.js +0 -1
  113. package/dist/assets/IssuesSurface-D4kD7_VW.js +0 -7
  114. package/dist/assets/PatchDiff-BtOv_oLB.js +0 -1
  115. package/dist/assets/PullRequestsSurface-PML07zr-.js +0 -2
  116. package/dist/assets/SessionUnreadDot-DXUn8-ss.js +0 -1
  117. package/dist/assets/SettingsView-BvUeFUqw.js +0 -6
  118. package/dist/assets/index-Cfrwo5uQ.js +0 -11
  119. package/dist/assets/index-D7k62S9M.css +0 -1
  120. package/dist/assets/runtimeEndpointReset-D8lAOCUB.js +0 -62
  121. package/dist/assets/useGitHubRemoteSearch-C0-6hhMJ.js +0 -1
@@ -1,7 +1,7 @@
1
- import{R as g}from"./vendor-react-Bz1tRBxM.js";import{t as w,bE as P,cJ as M}from"./useAppFontEffects-CoFst31H.js";import{aA as _,f as R}from"./index-Cfrwo5uQ.js";import{j as u}from"./vendor-boot-Ciu-Edvy.js";const J=e=>{const t=h(e);if(!t)return"";if(t==="/"||/^[A-Za-z]:\/$/.test(t))return t;const s=t.lastIndexOf("/");if(s<0)return t;if(s===0)return"/";const n=t.slice(0,s);return/^[A-Za-z]:$/.test(n)?`${n}/`:n},Q=e=>e.slice().sort((t,s)=>t.type!==s.type?t.type==="directory"?-1:1:t.name.localeCompare(s.name)),h=e=>{if(!e)return"";const t=e.replace(/\\/g,"/"),s=t.startsWith("//");let n=t.replace(/\/+/g,"/");s&&!n.startsWith("//")&&(n=`/${n}`);const o=n==="/",i=/^[A-Za-z]:\/$/.test(n);return!o&&!i&&(n=n.replace(/\/+$/,"")),n},X=e=>e.startsWith("/")||e.startsWith("//")||/^[A-Za-z]:\//.test(e),A=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,z=(e,t)=>{const s=h(t),n=h(e);if(!s||!n)return!1;const o=A(s),i=A(n);return i===o||i.startsWith(`${o}/`)},Y=(e,t)=>{const s=h(t),n=h(e);if(!z(n,s))return[];const i=n.slice(s.length).replace(/^\//,"").split("/"),c=[];let r=s;for(let f=0;f<i.length-1;f++)r=r?`${r}/${i[f]}`:i[f],c.push(r);return c},K=(e,t)=>{if(!t)return"";const s=h(t);if(!e||!z(s,e))return s;const n=s.slice(e.length);return n.startsWith("/")?n.slice(1):n},D=new Set(["node_modules"]),ee=e=>D.has(e),te=e=>e===".git",W=/(^|\/)\.git(\/|$)/,L=e=>W.test(h(e)),I=e=>{const t=h(e);return t==="node_modules"||t.endsWith("/node_modules")||t.includes("/node_modules/")},se=e=>{const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("is a directory")||s.includes("eisdir")},ne=e=>{const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("file not found")||s.includes("enoent")||s.includes("no such file")||s.includes("does not exist")},re=2e5,ae=e=>{let t=0,s=0;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===10&&(n>0&&e.charCodeAt(n-1)===13?t+=1:s+=1);return t>s?`\r
1
+ import{R as g}from"./vendor-react-Bz1tRBxM.js";import{t as w,bL as P,cT as M}from"./useAppFontEffects-FKnY7Fe2.js";import{as as _,f as R}from"./index-fmzQmSSv.js";import{j as u}from"./vendor-boot-3SaHYVb1.js";const Q=e=>{const t=h(e);if(!t)return"";if(t==="/"||/^[A-Za-z]:\/$/.test(t))return t;const s=t.lastIndexOf("/");if(s<0)return t;if(s===0)return"/";const n=t.slice(0,s);return/^[A-Za-z]:$/.test(n)?`${n}/`:n},J=e=>e.slice().sort((t,s)=>t.type!==s.type?t.type==="directory"?-1:1:t.name.localeCompare(s.name)),h=e=>{if(!e)return"";const t=e.replace(/\\/g,"/"),s=t.startsWith("//");let n=t.replace(/\/+/g,"/");s&&!n.startsWith("//")&&(n=`/${n}`);const o=n==="/",i=/^[A-Za-z]:\/$/.test(n);return!o&&!i&&(n=n.replace(/\/+$/,"")),n},X=e=>e.startsWith("/")||e.startsWith("//")||/^[A-Za-z]:\//.test(e),$=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,A=(e,t)=>{const s=h(t),n=h(e);if(!s||!n)return!1;const o=$(s),i=$(n);return i===o||i.startsWith(`${o}/`)},Y=(e,t)=>{const s=h(t),n=h(e);if(!A(n,s))return[];const i=n.slice(s.length).replace(/^\//,"").split("/"),c=[];let r=s;for(let f=0;f<i.length-1;f++)r=r?`${r}/${i[f]}`:i[f],c.push(r);return c},K=(e,t)=>{if(!t)return"";const s=h(t);if(!e||!A(s,e))return s;const n=s.slice(e.length);return n.startsWith("/")?n.slice(1):n},D=new Set(["node_modules"]),ee=e=>D.has(e),te=e=>e===".git",L=/(^|\/)\.git(\/|$)/,W=e=>L.test(h(e)),I=e=>{const t=h(e);return t==="node_modules"||t.endsWith("/node_modules")||t.includes("/node_modules/")},se=e=>{const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("is a directory")||s.includes("eisdir")},ne=e=>{const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("file not found")||s.includes("enoent")||s.includes("no such file")||s.includes("does not exist")},re=2e5,ae=e=>{let t=0,s=0;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===10&&(n>0&&e.charCodeAt(n-1)===13?t+=1:s+=1);return t>s?`\r
2
2
  `:`
3
3
  `},B=e=>e.replace(/\r\n/g,`
4
4
  `).replace(/\r/g,`
5
5
  `),ie=(e,t)=>{const s=B(e);return t===`\r
6
6
  `?s.replace(/\n/g,`\r
7
- `):s},oe=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="md"||t==="markdown"},le=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="json"||t==="jsonc"||t==="json5"||t==="geojson"},ce=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="html"||t==="htm"};function de({files:e,root:t,selectedPath:s,refreshDirectory:n,removeOpenPathsByPrefix:o,clearSelectedPath:i}){const c=g.useRef(null),[r,f]=g.useState(null),[a,m]=g.useState(null),[l,C]=g.useState(""),[F,p]=g.useState(!1),b=g.useCallback((v,y)=>{f(v),m(y),C(v==="rename"&&y.name||""),p(!1)},[]),x=g.useCallback(()=>f(null),[]),N=g.useCallback(async v=>{if(v?.preventDefault(),!r||!a)return;const y=l.trim();if(r==="createFile"&&!y){w.error("Filename is required");return}if(r==="createFolder"&&!y){w.error("Folder name is required");return}if(r==="rename"&&!y){w.error("Name is required");return}if(r==="createFile"&&!e.writeFile){w.error("Write not supported");return}if(r==="rename"&&!e.rename){w.error("Rename not supported");return}if(r==="delete"&&!e.delete){w.error("Delete not supported");return}p(!0);try{if(r==="createFile"){const d=a.path,S=h(`${d?`${d}/`:""}${y}`);try{(await e.writeFile(S,"",{expectedRevision:null})).success&&(w.success("File created"),await n(d))}catch(j){if(j?.reason==="file-revision-conflict"||j?.name==="FileRevisionConflictError")w.error("File already exists");else throw j}}else if(r==="createFolder"){const d=a.path,S=h(`${d?`${d}/`:""}${y}`);(await e.createDirectory(S)).success&&(w.success("Folder created"),await n(d))}else{const d=a.path,S=d.split("/").slice(0,-1).join("/"),j=s===d||s.startsWith(`${d}/`);(r==="rename"?await e.rename(d,h(`${S?`${S}/`:""}${y}`)):await e.delete(d)).success&&(w.success(r==="rename"?"Renamed successfully":"Deleted successfully"),await n(S),t&&o(t,d),j&&i())}f(null)}catch{w.error("Operation failed")}finally{p(!1)}},[i,e,l,r,n,o,t,s,a]);return{operation:r,target:a,inputValue:l,setInputValue:C,submitting:F,inputRef:c,open:b,close:x,submit:N,capabilities:{canCreateFile:!!e.writeFile,canCreateFolder:!!e.createDirectory,canRename:!!e.rename,canDelete:!!e.delete}}}function ue({directory:e,query:t,chrome:s,showGitignored:n}){const o=_(F=>F.searchFiles),i=P(t,200),[c,r]=g.useState([]),[f,a]=g.useState(!1),[m,l]=g.useState(!1);g.useEffect(()=>{const F=i.trim();if(!e||!F){r([]),a(!1),l(!1);return}let p=!1;return a(!0),l(!1),o(e,F,s==="mobile"?40:150,{includeHidden:!0,respectGitignore:s==="desktop"&&!n,type:"file"}).then(b=>{p||r(b.filter(x=>!L(x.relativePath??x.path)).filter(x=>n||!I(x.path)).map(x=>({name:x.name,path:h(x.path),type:"file",extension:x.extension,relativePath:x.relativePath})))}).catch(()=>{p||(r([]),l(!0))}).finally(()=>{p||a(!1)}),()=>{p=!0}},[s,i,e,o,n]);const C=t.trim()!==""&&t.trim()!==i.trim();return{results:c,searching:f||C,failed:m&&!C}}const E={"git-modified":{letter:"M",label:"Modified",textClass:"text-[var(--status-warning)]"},"git-added":{letter:"A",label:"New file",textClass:"text-[var(--status-success)]"},"git-deleted":{letter:"D",label:"Deleted",textClass:"text-[var(--status-error)]"}},H=e=>e in E,O=({status:e,className:t})=>{if(H(e)){const n=E[e];return u.jsx("span",{className:R("w-3 shrink-0 text-center font-mono typography-micro font-semibold",n.textClass,t),title:n.label,"aria-label":n.label,children:n.letter})}const s=e==="open"?"Open in a tab":"Unsaved changes";return u.jsx("span",{className:R("flex w-3 shrink-0 justify-center",t),title:s,"aria-label":s,children:u.jsx("span",{className:R("size-1.5 rounded-full",e==="open"?"bg-[var(--status-info)]":"bg-[var(--status-warning)]")})})},fe=({badge:e,className:t})=>{const s=[e.modified>0?`${e.modified} modified`:null,e.added>0?e.added===1?"1 new file":`${e.added} new files`:null].filter(Boolean);if(s.length===0)return null;const n=s.join(", ");return u.jsx("span",{className:R("flex w-3 shrink-0 justify-center",t),title:n,"aria-label":n,children:u.jsx("span",{className:R("size-1.5 rounded-full",e.modified>0?"bg-[var(--status-warning)]":"bg-[var(--status-success)]")})})},T=(e,t)=>{const s=t?.trim().toLowerCase();if(!s)return e;const n=e.toLowerCase().indexOf(s);return n<0?e:u.jsxs(u.Fragment,{children:[e.slice(0,n),u.jsx("mark",{className:"bg-transparent font-semibold text-foreground",children:e.slice(n,n+s.length)}),e.slice(n+s.length)]})},me=({path:e,status:t,active:s=!1,onClick:n,onDragStart:o,match:i})=>{const c=e.lastIndexOf("/"),r=e.slice(c+1),f=c>=0?e.slice(0,c):"";return u.jsxs("button",{type:"button",onClick:n,draggable:!!o,onDragStart:o,className:R("flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left transition-colors",s?"bg-interactive-selection/70":"hover:bg-interactive-hover/40",o&&"cursor-grab active:cursor-grabbing"),title:e,children:[u.jsx(M,{filePath:e}),u.jsx("span",{className:"min-w-0 truncate typography-meta text-foreground",children:T(r,i)}),u.jsx("span",{className:"min-w-0 flex-1 truncate pl-1 typography-meta text-muted-foreground [direction:rtl] [text-align:left]",children:u.jsx("bdi",{children:f})}),t?u.jsx(O,{status:t}):null]})},$=(e,t)=>e.startsWith(`${t}/`)?e.slice(t.length+1):e,V=e=>e.index==="A"||e.working_dir==="?"?"git-added":e.index==="D"?"git-deleted":e.index==="M"||e.working_dir==="M"?"git-modified":null,pe=({root:e,openPaths:t,gitFiles:s})=>{const n=new Set(t),o=new Map,i=new Map,c={modified:0,added:0};for(const a of s??[]){o.has(a.path)||o.set(a.path,a);const m=+(a.index==="M"||a.working_dir==="M"),l=+(a.index==="A"||a.working_dir==="?");if(m===0&&l===0)continue;c.modified+=m,c.added+=l;const C=a.path.split("/");for(let F=1;F<C.length;F+=1){const p=C.slice(0,F).join("/");if(!p)continue;let b=i.get(p);b||(b={modified:0,added:0},i.set(p,b)),b.modified+=m,b.added+=l}}return{getFileStatus:a=>{const m=o.size>0?o.get($(a,e)):void 0,l=m?V(m):null;return l||(n.has(a)?"open":null)},getFolderBadge:a=>{if(!s)return null;const m=$(a,e);if(!m)return c.modified+c.added>0?{...c}:null;const l=i.get(m);return l?{...l}:null}}},ge=e=>new Set(e);export{O as F,re as M,fe as a,X as b,Q as c,de as d,Y as e,me as f,K as g,V as h,te as i,le as j,oe as k,ce as l,ae as m,B as n,h as o,ie as p,ge as q,z as r,ee as s,A as t,ue as u,J as v,ne as w,se as x,pe as y};
7
+ `):s},oe=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="md"||t==="markdown"},le=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="json"||t==="jsonc"||t==="json5"||t==="geojson"},ce=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="html"||t==="htm"};function de({files:e,root:t,selectedPath:s,refreshDirectory:n,removeOpenPathsByPrefix:o,clearSelectedPath:i}){const c=g.useRef(null),[r,f]=g.useState(null),[a,m]=g.useState(null),[l,C]=g.useState(""),[F,p]=g.useState(!1),b=g.useCallback((v,y)=>{f(v),m(y),C(v==="rename"&&y.name||""),p(!1)},[]),x=g.useCallback(()=>f(null),[]),N=g.useCallback(async v=>{if(v?.preventDefault(),!r||!a)return;const y=l.trim();if(r==="createFile"&&!y){w.error("Filename is required");return}if(r==="createFolder"&&!y){w.error("Folder name is required");return}if(r==="rename"&&!y){w.error("Name is required");return}if(r==="createFile"&&!e.writeFile){w.error("Write not supported");return}if(r==="rename"&&!e.rename){w.error("Rename not supported");return}if(r==="delete"&&!e.delete){w.error("Delete not supported");return}p(!0);try{if(r==="createFile"){const d=a.path,S=h(`${d?`${d}/`:""}${y}`);try{(await e.writeFile(S,"",{expectedRevision:null})).success&&(w.success("File created"),await n(d))}catch(j){if(j?.reason==="file-revision-conflict"||j?.name==="FileRevisionConflictError")w.error("File already exists");else throw j}}else if(r==="createFolder"){const d=a.path,S=h(`${d?`${d}/`:""}${y}`);(await e.createDirectory(S)).success&&(w.success("Folder created"),await n(d))}else{const d=a.path,S=d.split("/").slice(0,-1).join("/"),j=s===d||s.startsWith(`${d}/`);(r==="rename"?await e.rename(d,h(`${S?`${S}/`:""}${y}`)):await e.delete(d)).success&&(w.success(r==="rename"?"Renamed successfully":"Deleted successfully"),await n(S),t&&o(t,d),j&&i())}f(null)}catch{w.error("Operation failed")}finally{p(!1)}},[i,e,l,r,n,o,t,s,a]);return{operation:r,target:a,inputValue:l,setInputValue:C,submitting:F,inputRef:c,open:b,close:x,submit:N,capabilities:{canCreateFile:!!e.writeFile,canCreateFolder:!!e.createDirectory,canRename:!!e.rename,canDelete:!!e.delete}}}function ue({directory:e,query:t,chrome:s,showGitignored:n}){const o=_(F=>F.searchFiles),i=P(t,200),[c,r]=g.useState([]),[f,a]=g.useState(!1),[m,l]=g.useState(!1);g.useEffect(()=>{const F=i.trim();if(!e||!F){r([]),a(!1),l(!1);return}let p=!1;return a(!0),l(!1),o(e,F,s==="mobile"?40:150,{includeHidden:!0,respectGitignore:s==="desktop"&&!n,type:"file"}).then(b=>{p||r(b.filter(x=>!W(x.relativePath??x.path)).filter(x=>n||!I(x.path)).map(x=>({name:x.name,path:h(x.path),type:"file",extension:x.extension,relativePath:x.relativePath})))}).catch(()=>{p||(r([]),l(!0))}).finally(()=>{p||a(!1)}),()=>{p=!0}},[s,i,e,o,n]);const C=t.trim()!==""&&t.trim()!==i.trim();return{results:c,searching:f||C,failed:m&&!C}}const E={"git-modified":{letter:"M",label:"Modified",textClass:"text-[var(--status-warning)]"},"git-added":{letter:"A",label:"New file",textClass:"text-[var(--status-success)]"},"git-deleted":{letter:"D",label:"Deleted",textClass:"text-[var(--status-error)]"}},H=e=>e in E,O=({status:e,className:t})=>{if(H(e)){const n=E[e];return u.jsx("span",{className:R("w-3 shrink-0 text-center font-mono typography-micro font-semibold",n.textClass,t),title:n.label,"aria-label":n.label,children:n.letter})}const s=e==="open"?"Open in a tab":"Unsaved changes";return u.jsx("span",{className:R("flex w-3 shrink-0 justify-center",t),title:s,"aria-label":s,children:u.jsx("span",{className:R("size-1.5 rounded-full",e==="open"?"bg-[var(--status-info)]":"bg-[var(--status-warning)]")})})},fe=({badge:e,className:t})=>{const s=[e.modified>0?`${e.modified} modified`:null,e.added>0?e.added===1?"1 new file":`${e.added} new files`:null].filter(Boolean);if(s.length===0)return null;const n=s.join(", ");return u.jsx("span",{className:R("flex w-3 shrink-0 justify-center",t),title:n,"aria-label":n,children:u.jsx("span",{className:R("size-1.5 rounded-full",e.modified>0?"bg-[var(--status-warning)]":"bg-[var(--status-success)]")})})},T=(e,t)=>{const s=t?.trim().toLowerCase();if(!s)return e;const n=e.toLowerCase().indexOf(s);return n<0?e:u.jsxs(u.Fragment,{children:[e.slice(0,n),u.jsx("mark",{className:"bg-transparent font-semibold text-foreground",children:e.slice(n,n+s.length)}),e.slice(n+s.length)]})},me=({path:e,status:t,active:s=!1,onClick:n,onDragStart:o,match:i})=>{const c=e.lastIndexOf("/"),r=e.slice(c+1),f=c>=0?e.slice(0,c):"";return u.jsxs("button",{type:"button",onClick:n,draggable:!!o,onDragStart:o,className:R("flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left transition-colors",s?"bg-interactive-selection/70":"hover:bg-interactive-hover/40",o&&"cursor-grab active:cursor-grabbing"),title:e,children:[u.jsx(M,{filePath:e}),u.jsx("span",{className:"min-w-0 truncate typography-meta text-foreground",children:T(r,i)}),u.jsx("span",{className:"min-w-0 flex-1 truncate pl-1 typography-meta text-muted-foreground [direction:rtl] [text-align:left]",children:u.jsx("bdi",{children:f})}),t?u.jsx(O,{status:t}):null]})},z=(e,t)=>e.startsWith(`${t}/`)?e.slice(t.length+1):e,V=e=>e.index==="A"||e.working_dir==="?"?"git-added":e.index==="D"?"git-deleted":e.index==="M"||e.working_dir==="M"?"git-modified":null,pe=({root:e,openPaths:t,gitFiles:s})=>{const n=new Set(t),o=new Map,i=new Map,c={modified:0,added:0};for(const a of s??[]){o.has(a.path)||o.set(a.path,a);const m=+(a.index==="M"||a.working_dir==="M"),l=+(a.index==="A"||a.working_dir==="?");if(m===0&&l===0)continue;c.modified+=m,c.added+=l;const C=a.path.split("/");for(let F=1;F<C.length;F+=1){const p=C.slice(0,F).join("/");if(!p)continue;let b=i.get(p);b||(b={modified:0,added:0},i.set(p,b)),b.modified+=m,b.added+=l}}return{getFileStatus:a=>{const m=o.size>0?o.get(z(a,e)):void 0,l=m?V(m):null;return l||(n.has(a)?"open":null)},getFolderBadge:a=>{if(!s)return null;const m=z(a,e);if(!m)return c.modified+c.added>0?{...c}:null;const l=i.get(m);return l?{...l}:null}}},ge=e=>new Set(e);export{O as F,re as M,fe as a,X as b,J as c,de as d,Y as e,me as f,K as g,V as h,te as i,le as j,oe as k,ce as l,ae as m,B as n,h as o,ie as p,ge as q,A as r,ee as s,$ as t,ue as u,Q as v,ne as w,se as x,pe as y};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-boot-Ciu-Edvy.js";import{R as h}from"./vendor-react-Bz1tRBxM.js";import{a$ as y,b0 as N,B as b,I as S,b1 as C,dT as k,dU as r}from"./useAppFontEffects-CoFst31H.js";const B=h.memo(function({scope:n,isGitRepo:a,branchAvailable:i,allCount:o,workingCount:c,stagedCount:d,turnCount:m,branchCount:u,focusedFilePath:l=null,onScopeChange:g}){const[j,x]=h.useState(!1),p=n==="all"?o:n==="staged"?d:n==="turn"?m:n==="branch"?u:c,w=n==="staged"?"Staged":n==="turn"?"Last turn":n==="branch"?"Branch":n==="all"?"All":"Changed";return e.jsxs(y,{open:j,onOpenChange:x,children:[e.jsx(N,{asChild:!0,children:e.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:"h-8 flex-shrink-0 gap-1.5 px-2 py-1 normal-case","aria-label":"Select change mode",children:[e.jsxs("span",{className:"whitespace-nowrap font-medium",children:[w," ",e.jsx("span",{className:"diff-toolbar__scope-count font-normal text-muted-foreground",children:l?`· ${l.split("/").pop()??l}`:p===1?"1 file":`${p} files`})]}),e.jsx(S,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-70"})]})}),e.jsx(C,{align:"start",className:"w-40",children:e.jsxs(k,{value:n,onValueChange:t=>{(t==="all"||t==="working"||t==="staged"||t==="turn"||t==="branch")&&(g?.(t),x(!1))},children:[a!==!1?e.jsx(r,{value:"all",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"All"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:o})]})}):null,a!==!1?e.jsx(r,{value:"working",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Changed"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:c})]})}):null,a!==!1?e.jsx(r,{value:"staged",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Staged"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}):null,e.jsx(r,{value:"turn",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Last turn"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:m})]})}),i?e.jsx(r,{value:"branch",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Branch"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:u})]})}):null]})})]})}),f={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}};function _(s){const n=s.index?.trim(),a=s.working_dir?.trim(),i=n&&n!=="?"?n.charAt(0):a?.charAt(0)||n?.charAt(0)||"M";return f[i]??f.M}function A(s){const n=s.index?.trim();return!!(n&&n!=="?")}function M(s){return!!s.working_dir?.trim()||s.index?.trim()==="?"}function I(s){return A(s)&&!M(s)}function O(s){const n=s.index?.trim(),a=s.working_dir?.trim();return n==="A"||a==="A"||n==="?"||a==="?"}export{B as C,M as a,I as b,O as c,_ as d,A as i};
1
+ import{j as e}from"./vendor-boot-3SaHYVb1.js";import{R as h}from"./vendor-react-Bz1tRBxM.js";import{a$ as y,b0 as N,B as b,I as S,b1 as C,e1 as k,e2 as r}from"./useAppFontEffects-FKnY7Fe2.js";const B=h.memo(function({scope:n,isGitRepo:a,branchAvailable:i,allCount:o,workingCount:c,stagedCount:d,turnCount:m,branchCount:u,focusedFilePath:l=null,onScopeChange:g}){const[j,x]=h.useState(!1),p=n==="all"?o:n==="staged"?d:n==="turn"?m:n==="branch"?u:c,w=n==="staged"?"Staged":n==="turn"?"Last turn":n==="branch"?"Branch":n==="all"?"All":"Changed";return e.jsxs(y,{open:j,onOpenChange:x,children:[e.jsx(N,{asChild:!0,children:e.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:"h-8 flex-shrink-0 gap-1.5 px-2 py-1 normal-case","aria-label":"Select change mode",children:[e.jsxs("span",{className:"whitespace-nowrap font-medium",children:[w," ",e.jsx("span",{className:"diff-toolbar__scope-count font-normal text-muted-foreground",children:l?`· ${l.split("/").pop()??l}`:p===1?"1 file":`${p} files`})]}),e.jsx(S,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-70"})]})}),e.jsx(C,{align:"start",className:"w-40",children:e.jsxs(k,{value:n,onValueChange:t=>{(t==="all"||t==="working"||t==="staged"||t==="turn"||t==="branch")&&(g?.(t),x(!1))},children:[a!==!1?e.jsx(r,{value:"all",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"All"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:o})]})}):null,a!==!1?e.jsx(r,{value:"working",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Changed"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:c})]})}):null,a!==!1?e.jsx(r,{value:"staged",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Staged"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}):null,e.jsx(r,{value:"turn",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Last turn"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:m})]})}),i?e.jsx(r,{value:"branch",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Branch"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:u})]})}):null]})})]})}),f={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}};function _(s){const n=s.index?.trim(),a=s.working_dir?.trim(),i=n&&n!=="?"?n.charAt(0):a?.charAt(0)||n?.charAt(0)||"M";return f[i]??f.M}function A(s){const n=s.index?.trim();return!!(n&&n!=="?")}function M(s){return!!s.working_dir?.trim()||s.index?.trim()==="?"}function I(s){return A(s)&&!M(s)}function O(s){const n=s.index?.trim(),a=s.working_dir?.trim();return n==="A"||a==="A"||n==="?"||a==="?"}export{B as C,M as a,I as b,O as c,_ as d,A as i};
@@ -1,4 +1,4 @@
1
- import{U as m,V as p,W as u,X as w}from"./GitHubDetailScaffold-a27RksFo.js";import{b$ as f}from"./useAppFontEffects-CoFst31H.js";const x=[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"all",label:"All"}],k=[{id:"all",label:"All"},{id:"mine",label:"Created by me"},{id:"assigned",label:"Assigned to me"},{id:"mentioned",label:"Mentioned"}],y=[{id:"updated",label:"Recently updated"},{id:"newest",label:"Newest"},{id:"oldest",label:"Oldest"}],N=[{id:"completed",label:"Completed"},{id:"not_planned",label:"Not planned"}],_=(e,t,s)=>{if(!t&&e!=="comment")return{allowed:!1,reason:"Issue is still loading"};switch(e){case"close":return t?.state==="closed"?{allowed:!1,reason:"Already closed"}:u(s)?{allowed:!1,reason:"You need write access or be the author to close"}:{allowed:!0,reason:null};case"reopen":return t?.state!=="closed"?{allowed:!1,reason:"Already open"}:u(s)?{allowed:!1,reason:"You need write access or be the author to reopen"}:{allowed:!0,reason:null};case"edit":return u(s)?{allowed:!1,reason:"You need write access or be the author to edit"}:{allowed:!0,reason:null};case"labels":return p(s)?{allowed:!1,reason:"You need write access to change labels"}:{allowed:!0,reason:null};case"assignees":return p(s)?{allowed:!1,reason:"You need write access to change assignees"}:{allowed:!0,reason:null};case"comment":return m(s);default:return{allowed:!0,reason:null}}},E=(e,t)=>{switch(e){case"close-not-planned":return{title:`Close issue #${t} as not planned?`,detail:"The issue will close without being completed. You can reopen it later.",confirm:"Close as not planned",progress:"Closing…"};case"reopen":return{title:`Reopen issue #${t}?`,detail:"The issue will return to its previous open state.",confirm:"Reopen issue",progress:"Reopening…"};default:return{title:`Close issue #${t} as completed?`,detail:"The issue will be recorded as completed. You can reopen it later.",confirm:"Close as completed",progress:"Closing…"}}},L=e=>e==="reopen"?{state:"open"}:{state:"closed",stateReason:e==="close-not-planned"?"not_planned":"completed"},P=e=>{const t={},s=w(e.title,300);return s&&(t.title=s),e.body!==void 0&&e.body.length>2e5&&(t.body="Body is too long"),{ok:Object.keys(t).length===0,errors:t}},A=(e,t)=>e.trim()?t.trim()?`${e.replace(/\s+$/,"")}
1
+ import{U as m,V as p,W as u,X as w}from"./GitHubDetailScaffold-CrtJwlqV.js";import{c6 as f}from"./useAppFontEffects-FKnY7Fe2.js";const x=[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"all",label:"All"}],k=[{id:"all",label:"All"},{id:"mine",label:"Created by me"},{id:"assigned",label:"Assigned to me"},{id:"mentioned",label:"Mentioned"}],y=[{id:"updated",label:"Recently updated"},{id:"newest",label:"Newest"},{id:"oldest",label:"Oldest"}],N=[{id:"completed",label:"Completed"},{id:"not_planned",label:"Not planned"}],_=(e,t,s)=>{if(!t&&e!=="comment")return{allowed:!1,reason:"Issue is still loading"};switch(e){case"close":return t?.state==="closed"?{allowed:!1,reason:"Already closed"}:u(s)?{allowed:!1,reason:"You need write access or be the author to close"}:{allowed:!0,reason:null};case"reopen":return t?.state!=="closed"?{allowed:!1,reason:"Already open"}:u(s)?{allowed:!1,reason:"You need write access or be the author to reopen"}:{allowed:!0,reason:null};case"edit":return u(s)?{allowed:!1,reason:"You need write access or be the author to edit"}:{allowed:!0,reason:null};case"labels":return p(s)?{allowed:!1,reason:"You need write access to change labels"}:{allowed:!0,reason:null};case"assignees":return p(s)?{allowed:!1,reason:"You need write access to change assignees"}:{allowed:!0,reason:null};case"comment":return m(s);default:return{allowed:!0,reason:null}}},E=(e,t)=>{switch(e){case"close-not-planned":return{title:`Close issue #${t} as not planned?`,detail:"The issue will close without being completed. You can reopen it later.",confirm:"Close as not planned",progress:"Closing…"};case"reopen":return{title:`Reopen issue #${t}?`,detail:"The issue will return to its previous open state.",confirm:"Reopen issue",progress:"Reopening…"};default:return{title:`Close issue #${t} as completed?`,detail:"The issue will be recorded as completed. You can reopen it later.",confirm:"Close as completed",progress:"Closing…"}}},L=e=>e==="reopen"?{state:"open"}:{state:"closed",stateReason:e==="close-not-planned"?"not_planned":"completed"},P=e=>{const t={},s=w(e.title,300);return s&&(t.title=s),e.body!==void 0&&e.body.length>2e5&&(t.body="Body is too long"),{ok:Object.keys(t).length===0,errors:t}},A=(e,t)=>e.trim()?t.trim()?`${e.replace(/\s+$/,"")}
2
2
 
3
3
  ${t}`:e:t,h=e=>e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"issue",R=(e,t)=>`issue-${e}-${h(t)}`,G=(e,t)=>{const s=e.trim();if(!s)return{link:null,outOfScope:!1};const c=s.match(/^#(\d{1,7})$/);if(c)return{link:{kind:"issue",number:Number(c[1]),owner:"",repo:""},outOfScope:!1};const r=s.match(/^([\w.-]+)\/([\w.-]+)#(\d{1,7})$/);if(r){const l=r[1].toLowerCase(),n=r[2].toLowerCase(),a=Number(r[3]);return t.some(i=>i.owner?.toLowerCase()===l&&i.repo?.toLowerCase()===n)?{link:{kind:"issue",number:a,owner:l,repo:n},outOfScope:!1}:{link:null,outOfScope:!0}}const o=s.match(/^https?:\/\/([^/]+)\/([\w.-]+)\/([\w.-]+)\/(issues|pull)\/(\d{1,7})(?:[/?#].*)?$/i);if(o){const l=o[1].toLowerCase(),n=o[2].toLowerCase(),a=o[3].toLowerCase().replace(/\.git$/,""),d=o[4].toLowerCase()==="pull"?"pr":"issue",i=Number(o[5]);return t.some(b=>b.ref.toLowerCase()===`${l}/${n}/${a}`)?{link:{kind:d,number:i,owner:n,repo:a},outOfScope:!1}:{link:null,outOfScope:!0}}return{link:null,outOfScope:!1}},H=e=>`Work on this GitHub issue. Read the quoted context below, then propose a plan and wait for confirmation before changing code.
4
4
 
@@ -7,4 +7,4 @@ ${e.url}
7
7
 
8
8
  ${e.contextText}`,S="GitHub issue context (JSON)",g="GitHub pull request context (JSON)",C=e=>{const t=e.kind==="pr"?"PR":"Issue",s=e.title.trim()||"(untitled)";return`${t} #${e.number}: ${s}`},T=e=>{const t=e.title.trim()||"(untitled)";return e.kind==="pr"?`${g}
9
9
  ${JSON.stringify({pr:{number:e.number,title:t,url:e.url}})}`:`${S}
10
- ${JSON.stringify({issue:{number:e.number,title:t,url:e.url}})}`},U=()=>({appendVisibleText:e=>{f.getState().setPendingInputText(e,"append")},appendSyntheticText:e=>{const t=f.getState(),s=t.pendingSyntheticParts??[];t.setPendingSyntheticParts([...s,{text:e,synthetic:!0}])}}),V=(e,t)=>{t.appendVisibleText(C(e)),t.appendSyntheticText(T(e)),e.contextText.trim()&&t.appendSyntheticText(e.contextText)};export{N as C,x as I,y as a,k as b,H as c,T as d,V as e,U as f,_ as g,L as h,R as i,E as j,A as k,G as p,h as s,P as v};
10
+ ${JSON.stringify({issue:{number:e.number,title:t,url:e.url}})}`},U=()=>({appendVisibleText:e=>{f.getState().setPendingInputText(e,"append")},appendSyntheticText:e=>{const t=f.getState(),s=t.pendingSyntheticParts??[];t.setPendingSyntheticParts([...s,{text:e,synthetic:!0}])}}),V=(e,t)=>{t.appendVisibleText(C(e)),t.appendSyntheticText(T(e)),e.contextText.trim()&&t.appendSyntheticText(e.contextText)};export{N as C,y as I,k as a,x as b,H as c,T as d,V as e,U as f,_ as g,L as h,R as i,E as j,A as k,G as p,h as s,P as v};