ompchamber 1.2.1 → 2.0.1
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.
- package/README.md +143 -147
- package/dist/client/index.html +4 -2
- package/dist/client/static/css/index.5f630421b7.css +2 -0
- package/dist/client/static/js/77.0d81c74cf0.js +139 -0
- package/dist/client/static/js/async/1k.973e8e21fc.js +2 -0
- package/dist/client/static/js/async/{3y.3186ecdd63.js → 3y.3530b824ad.js} +6 -6
- package/dist/client/static/js/async/{q.b453193538.js → 4m.928a1dde85.js} +10 -10
- package/dist/client/static/js/async/66.5dfa29f957.js +93 -0
- package/dist/client/static/js/async/7g.a7814350c3.js +1 -0
- package/dist/client/static/js/async/ar.9303e5f2e8.js +2 -0
- package/dist/client/static/js/async/{cx.9c8268d542.js → cx.3cb0242a3a.js} +1 -1
- package/dist/client/static/js/async/e.93214d622b.js +79 -0
- package/dist/client/static/js/async/g.cb81980498.js +2 -0
- package/dist/client/static/js/async/h1.393f066d09.js +1 -0
- package/dist/client/static/js/async/jl.874d352278.js +1 -0
- package/dist/client/static/js/async/{k.d16cd09ae7.js → k.3210286401.js} +1 -1
- package/dist/client/static/js/async/{m.2e1ea3db9e.js → m.eb2e6752e2.js} +3 -3
- package/dist/client/static/js/async/m.eb2e6752e2.js.LICENSE.txt +11 -0
- package/dist/client/static/js/async/mt.0352e976d8.js +1 -0
- package/dist/client/static/js/async/{oc.eb22093f05.js → oc.b73042e8bd.js} +1 -1
- package/dist/client/static/js/async/{og.53f068804c.js → og.8eb577893a.js} +1 -1
- package/dist/client/static/js/async/px.fc6877924b.js +1 -0
- package/dist/client/static/js/async/q.22588845a9.js +21 -0
- package/dist/client/static/js/async/{q5.88b50ffa95.js → q5.97dc1481b6.js} +1 -1
- package/dist/client/static/js/async/s.0f395cdda5.js +94 -0
- package/dist/client/static/js/async/{tr.2a0d2b7600.js → tr.e878658140.js} +1 -1
- package/dist/client/static/js/async/vt.42416b707d.js +1 -0
- package/dist/client/static/js/async/x1.da8687159b.js +90 -0
- package/dist/client/static/js/async/xe.da8dcc2015.js +2 -0
- package/dist/client/static/js/async/xe.da8dcc2015.js.LICENSE.txt +11 -0
- package/dist/client/static/js/async/{xn.6360379f71.js → xn.6510c0abe2.js} +2 -2
- package/dist/client/static/js/async/{yx.af2936c368.js → xn1.83a7784fe1.js} +3 -3
- package/dist/client/static/js/async/xn1.83a7784fe1.js.LICENSE.txt +11 -0
- package/dist/client/static/js/async/yg.35bebd6d0c.js +149 -0
- package/dist/client/static/js/async/yv.d99d829136.js +1 -0
- package/dist/client/static/js/index.1fd9e1c543.js +38 -0
- package/package.json +3 -3
- package/src/client/components/common/ComposerTextarea.tsx +9 -1
- package/src/client/components/common/MarkdownRenderer.tsx +50 -12
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +9 -3
- package/src/client/components/settings/Modal.tsx +11 -2
- package/src/client/components/settings/categories/AppearanceSettings.tsx +7 -30
- package/src/client/components/settings/categories/ProviderSettings.tsx +2 -0
- package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +61 -0
- package/src/client/components/settings/categories/appearance-settings/ThemeGrid.tsx +80 -0
- package/src/client/components/settings/categories/chat-settings/TitleSection.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +43 -6
- package/src/client/components/settings/categories/provider-settings/ModelConfigModal.tsx +54 -54
- package/src/client/components/workspace/SearchPanel.tsx +16 -3
- package/src/client/components/workspace/btw-panel/AskCard.tsx +11 -6
- package/src/client/components/workspace/btw-panel/Messages.tsx +105 -51
- package/src/client/components/workspace/btw-panel/index.tsx +124 -45
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +30 -14
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +10 -1
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +8 -2
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +27 -16
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +11 -0
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +8 -0
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +12 -1
- package/src/client/components/workspace/chat-timeline/index.tsx +7 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +42 -15
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +13 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +13 -4
- package/src/client/components/workspace/diff-panel/SplitView.tsx +4 -1
- package/src/client/components/workspace/diff-panel/UnifiedView.tsx +70 -65
- package/src/client/components/workspace/diff-panel/index.tsx +8 -1
- package/src/client/components/workspace/editor/index.tsx +18 -2
- package/src/client/components/workspace/file-explorer/GitRepoDropdown.tsx +15 -41
- package/src/client/components/workspace/file-explorer/index.tsx +86 -16
- package/src/client/components/workspace/git-panel/index.tsx +60 -78
- package/src/client/components/workspace/terminal-panel/Header.tsx +16 -1
- package/src/client/components/workspace/terminal-panel/RealtimeXtermView.tsx +5 -5
- package/src/client/components/workspace/terminal-panel/index.tsx +6 -2
- package/src/client/components/workspace/terminal-panel/mount.ts +2 -2
- package/src/client/data/theme/terminal.ts +50 -52
- package/src/client/hooks/chat/btw/index.ts +139 -18
- package/src/client/hooks/chat/btw/intercept.ts +8 -8
- package/src/client/hooks/chat/btw/mode.ts +111 -16
- package/src/client/hooks/chat/composer/index.ts +10 -4
- package/src/client/hooks/chat/timeline/access-mode.ts +41 -0
- package/src/client/hooks/chat/timeline/ask-frames.test.ts +87 -0
- package/src/client/hooks/chat/timeline/ask-frames.ts +20 -1
- package/src/client/hooks/chat/timeline/auto-scroll.ts +13 -4
- package/src/client/hooks/chat/timeline/index.ts +8 -20
- package/src/client/hooks/chat/timeline/queue.ts +66 -9
- package/src/client/hooks/chat/timeline/scroll.test.ts +260 -0
- package/src/client/hooks/chat/timeline/scroll.ts +93 -20
- package/src/client/hooks/chat/timeline/session-load.ts +7 -1
- package/src/client/hooks/chat/timeline/session-pagination.test.ts +167 -0
- package/src/client/hooks/chat/timeline/session-pagination.ts +37 -11
- package/src/client/hooks/editor/save-file.ts +62 -0
- package/src/client/hooks/editor/use-file-editor.test.ts +61 -5
- package/src/client/hooks/editor/use-file-editor.ts +38 -29
- package/src/client/hooks/editor/use-file-transfer.ts +5 -2
- package/src/client/hooks/settings/providers.ts +34 -3
- package/src/client/hooks/ui/open-file.ts +7 -1
- package/src/client/hooks/ui/theme.ts +82 -57
- package/src/client/hooks/workspace/file-tabs.ts +5 -1
- package/src/client/hooks/workspace/repo-scope/index.ts +119 -0
- package/src/client/hooks/workspace/repo-scope/store.test.ts +161 -0
- package/src/client/hooks/workspace/repo-scope/store.ts +201 -0
- package/src/client/hooks/workspace/search-stream.ts +24 -5
- package/src/client/main.tsx +6 -0
- package/src/client/tailwind.css +19 -56
- package/src/server/lib/btw/child.server.ts +41 -0
- package/src/server/lib/btw/lifecycle.server.ts +254 -0
- package/src/server/lib/btw/prompt.ts +13 -5
- package/src/server/lib/btw/registry.server.ts +13 -4
- package/src/server/lib/btw/runtime.server.ts +149 -156
- package/src/server/lib/btw/schema.server.ts +27 -0
- package/src/server/lib/btw/service.server.ts +106 -5
- package/src/server/lib/btw/store.server.ts +57 -6
- package/src/server/lib/db/schema.ts +4 -0
- package/src/server/lib/db/settings-store.test.ts +65 -0
- package/src/server/lib/db/settings-store.ts +25 -0
- package/src/server/lib/fs/atomic-write.ts +42 -4
- package/src/server/lib/fs/config-lock.ts +74 -0
- package/src/server/lib/fs/git-ignore.ts +55 -5
- package/src/server/lib/fs/ripgrep.ts +119 -0
- package/src/server/lib/lifecycle/identity.ts +10 -64
- package/src/server/lib/lifecycle/proc/darwin.ts +238 -0
- package/src/server/lib/lifecycle/proc/index.ts +38 -0
- package/src/server/lib/lifecycle/proc/linux.ts +80 -0
- package/src/server/lib/lifecycle/proc/ps.ts +86 -0
- package/src/server/lib/lifecycle/proc/types.ts +33 -0
- package/src/server/lib/lifecycle/proc/win32.ts +53 -0
- package/src/server/lib/models/provider-registry.server.ts +2 -2
- package/src/server/lib/models/registry.server.ts +1 -1
- package/src/server/lib/omp/config/behavior.ts +17 -17
- package/src/server/lib/omp/config/disabled-providers.ts +84 -35
- package/src/server/lib/omp/config/document.ts +128 -0
- package/src/server/lib/omp/config/extensions.ts +11 -10
- package/src/server/lib/omp/config/mcp.ts +4 -57
- package/src/server/lib/omp/config/model-overrides.ts +123 -0
- package/src/server/lib/omp/config/models-config.ts +92 -0
- package/src/server/lib/omp/config/models-validation.ts +159 -0
- package/src/server/lib/omp/config/path-scoped.ts +74 -0
- package/src/server/lib/omp/config/providers.ts +241 -211
- package/src/server/lib/omp/config/roles.ts +6 -14
- package/src/server/lib/omp/core/auth-credentials.ts +1 -1
- package/src/server/lib/omp/rpc/frame-fold.test.ts +124 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +43 -24
- package/src/server/lib/omp/rpc/lifecycle.test.ts +41 -0
- package/src/server/lib/omp/rpc/manager.ts +21 -21
- package/src/server/lib/omp/rpc/pending-ui-dialogs.ts +11 -7
- package/src/server/lib/omp/rpc/session-commands.ts +17 -29
- package/src/server/lib/omp/rpc/session-registry.ts +5 -66
- package/src/server/lib/omp/rpc/web-state.ts +0 -6
- package/src/server/lib/omp/session/auto-title.server.test.ts +109 -11
- package/src/server/lib/omp/session/auto-title.server.ts +95 -20
- package/src/server/lib/omp/session/sidebar-data.server.ts +11 -6
- package/src/server/lib/queue/delivery-dispatch.server.test.ts +162 -0
- package/src/server/lib/queue/delivery-harness.ts +88 -0
- package/src/server/lib/queue/delivery.server.test.ts +78 -149
- package/src/server/lib/queue/delivery.server.ts +105 -13
- package/src/server/lib/queue/store.server.ts +30 -5
- package/src/server/lib/terminal/foreground.test.ts +164 -0
- package/src/server/lib/terminal/foreground.ts +34 -6
- package/src/server/lib/terminal/history.ts +8 -7
- package/src/server/plugins/compress.ts +33 -5
- package/src/server/plugins/ssr.ts +14 -7
- package/src/server/routes/btw/topics.ts +89 -2
- package/src/server/routes/fs/action.test.ts +64 -0
- package/src/server/routes/fs/action.ts +10 -1
- package/src/server/routes/fs/git.ts +5 -6
- package/src/server/routes/fs/search.ts +17 -26
- package/src/server/routes/sessions/queue.ts +17 -4
- package/src/server/routes/settings/index.ts +2 -0
- package/src/server/routes/settings/model-override.ts +69 -0
- package/src/server/routes/settings/provider-models.ts +35 -12
- package/src/server/routes/settings/providers.ts +31 -1
- package/src/server/routes/settings/root.ts +8 -3
- package/src/shared/lib/chat/btw/client.ts +34 -0
- package/src/shared/lib/chat/timeline/tool-phrases.ts +7 -0
- package/src/shared/lib/code/line-endings.test.ts +38 -0
- package/src/shared/lib/code/line-endings.ts +56 -0
- package/src/shared/lib/code/shiki-themes.ts +9 -5
- package/src/shared/lib/fs/file-tree.ts +17 -12
- package/src/shared/lib/markdown/autolink.test.ts +32 -0
- package/src/shared/lib/markdown/autolink.ts +50 -0
- package/src/shared/lib/markdown/document-urls.test.ts +68 -0
- package/src/shared/lib/markdown/document-urls.ts +118 -0
- package/src/shared/lib/markdown/marked.ts +27 -15
- package/src/shared/lib/markdown/mermaid.ts +2 -2
- package/src/shared/lib/models/catalog.ts +1 -1
- package/src/shared/lib/omp/session/schema-migrations.ts +30 -0
- package/src/shared/lib/omp/session/stream-state.server.test.ts +54 -0
- package/src/shared/lib/omp/session/stream-state.server.ts +70 -21
- package/src/shared/lib/settings/client.ts +10 -4
- package/src/shared/lib/settings/diff.test.ts +31 -0
- package/src/shared/lib/settings/diff.ts +37 -0
- package/src/shared/lib/theme/catalog.test.ts +168 -0
- package/src/shared/lib/theme/catalog.ts +98 -0
- package/src/shared/lib/theme/color.ts +88 -0
- package/src/shared/lib/theme/css.ts +70 -0
- package/src/shared/lib/theme/palettes/chamber.ts +61 -0
- package/src/shared/lib/theme/palettes/dark.ts +313 -0
- package/src/shared/lib/theme/palettes/light.ts +313 -0
- package/src/shared/types/btw.ts +83 -4
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/settings/provider.ts +8 -1
- package/src/shared/types/settings/state.ts +10 -4
- package/src/shared/types/theme.ts +48 -0
- package/dist/client/static/css/index.b938f4a693.css +0 -2
- package/dist/client/static/js/77.8022a800b5.js +0 -139
- package/dist/client/static/js/async/1k.a411fe5b43.js +0 -2
- package/dist/client/static/js/async/66.86544ad741.js +0 -93
- package/dist/client/static/js/async/7g.db82aca7ba.js +0 -1
- package/dist/client/static/js/async/ar.ad5c8822a8.js +0 -2
- package/dist/client/static/js/async/e.6443e739a2.js +0 -79
- package/dist/client/static/js/async/g.ee41bfed7f.js +0 -2
- package/dist/client/static/js/async/h1.d7091cef78.js +0 -1
- package/dist/client/static/js/async/jl.4911fa3383.js +0 -1
- package/dist/client/static/js/async/m.2e1ea3db9e.js.LICENSE.txt +0 -6
- package/dist/client/static/js/async/mt.853be2b5aa.js +0 -1
- package/dist/client/static/js/async/ot.84c71b308f.js +0 -2
- package/dist/client/static/js/async/px.783b6f91f2.js +0 -1
- package/dist/client/static/js/async/q8.7f1b48e9cd.js +0 -21
- package/dist/client/static/js/async/q8.7f1b48e9cd.js.LICENSE.txt +0 -6
- package/dist/client/static/js/async/s.aad2ecebc6.js +0 -94
- package/dist/client/static/js/async/vt.20406a5604.js +0 -1
- package/dist/client/static/js/async/x1.fe8af17016.js +0 -90
- package/dist/client/static/js/async/xn.6360379f71.js.LICENSE.txt +0 -6
- package/dist/client/static/js/async/yg.5a94e1fc8a.js +0 -149
- package/dist/client/static/js/async/yv.2fa22f009a.js +0 -1
- package/dist/client/static/js/index.5fe7a2cb64.js +0 -34
- package/src/client/components/workspace/btw-panel/Composer.tsx +0 -183
- package/src/client/components/workspace/btw-panel/attachments.ts +0 -80
- /package/dist/client/static/js/{77.8022a800b5.js.LICENSE.txt → 77.0d81c74cf0.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{g.ee41bfed7f.js.LICENSE.txt → 1k.973e8e21fc.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{3y.3186ecdd63.js.LICENSE.txt → 3y.3530b824ad.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{ot.84c71b308f.js.LICENSE.txt → 4m.928a1dde85.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{q.b453193538.js.LICENSE.txt → ar.9303e5f2e8.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{yx.af2936c368.js.LICENSE.txt → g.cb81980498.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{1k.a411fe5b43.js.LICENSE.txt → q.22588845a9.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{ar.ad5c8822a8.js.LICENSE.txt → xn.6510c0abe2.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/{index.5fe7a2cb64.js.LICENSE.txt → index.1fd9e1c543.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["x1"],{WJ(e,t,n){var i=n("Yr"),s=n("M4"),o=n("Gt"),r=(0,o.K)((e,t,n,o)=>{e.attr("class",n);let{width:r,height:l,x:h,y:d}=a(e,t);(0,i.a$)(e,l,r,o);let g=c(h,d,r,l,t);e.attr("viewBox",g),s.R.debug(`viewBox configured: ${g} with padding: ${t}`)},"setupViewPortForSVG"),a=(0,o.K)((e,t)=>{let n=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:n.width+2*t,height:n.height+2*t,x:n.x,y:n.y}},"calculateDimensionsWithPadding"),c=(0,o.K)((e,t,n,i,s)=>`${e-s} ${t-s} ${n} ${i}`,"createViewBox");n.d(t,{P:()=>r})},OT(e,t,n){var i=n("Gt"),s=n("El"),o=(0,i.K)((e,t)=>{let n;return"sandbox"===t&&(n=(0,s.Ltv)("#i"+e)),("sandbox"===t?(0,s.Ltv)(n.nodes()[0].contentDocument.body):(0,s.Ltv)("body")).select(`[id="${e}"]`)},"getDiagramElement");n.d(t,{A:()=>o})},Px(e,t,n){n.d(t,{diagram:()=>_});var i=n("OT"),s=n("WJ"),o=n("mW");n("Q"),n("ix"),n("LC"),n("bQ"),n("Ut"),n("PF"),n("iV"),n("h5"),n("pK"),n("NH");var r=n("Yr"),a=n("M4"),c=n("Gt");let l=new Uint8Array(16),h=[];for(let e=0;e<256;++e)h.push((e+256).toString(16).slice(1));var d=n("HAv"),g=n("CM"),u=n("xh"),p=function(){var e=(0,c.K)(function(e,t,n,i){for(n=n||{},i=e.length;i--;n[e[i]]=t);return n},"o"),t=[1,4],n=[1,13],i=[1,12],s=[1,15],o=[1,16],r=[1,20],a=[1,19],l=[6,7,8],h=[1,26],d=[1,24],g=[1,25],u=[6,7,11],p=[1,6,13,15,16,19,22],y=[1,33],m=[1,34],f=[1,6,7,11,13,15,16,19,22],b={trace:(0,c.K)(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:(0,c.K)(function(e,t,n,i,s,o,r){var a=o.length-1;switch(s){case 6:case 7:return i;case 8:i.getLogger().trace("Stop NL ");break;case 9:i.getLogger().trace("Stop EOF ");break;case 11:i.getLogger().trace("Stop NL2 ");break;case 12:i.getLogger().trace("Stop EOF2 ");break;case 15:i.getLogger().info("Node: ",o[a].id),i.addNode(o[a-1].length,o[a].id,o[a].descr,o[a].type);break;case 16:i.getLogger().trace("Icon: ",o[a]),i.decorateNode({icon:o[a]});break;case 17:case 21:i.decorateNode({class:o[a]});break;case 18:i.getLogger().trace("SPACELIST");break;case 19:i.getLogger().trace("Node: ",o[a].id),i.addNode(0,o[a].id,o[a].descr,o[a].type);break;case 20:i.decorateNode({icon:o[a]});break;case 25:i.getLogger().trace("node found ..",o[a-2]),this.$={id:o[a-1],descr:o[a-1],type:i.getType(o[a-2],o[a])};break;case 26:this.$={id:o[a],descr:o[a],type:i.nodeType.DEFAULT};break;case 27:i.getLogger().trace("node found ..",o[a-3]),this.$={id:o[a-3],descr:o[a-1],type:i.getType(o[a-2],o[a])}}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:n,7:[1,10],9:9,12:11,13:i,14:14,15:s,16:o,17:17,18:18,19:r,22:a},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:n,12:21,13:i,14:14,15:s,16:o,17:17,18:18,19:r,22:a},{6:n,9:22,12:11,13:i,14:14,15:s,16:o,17:17,18:18,19:r,22:a},{6:h,7:d,10:23,11:g},e(u,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:r,22:a}),e(u,[2,18]),e(u,[2,19]),e(u,[2,20]),e(u,[2,21]),e(u,[2,23]),e(u,[2,24]),e(u,[2,26],{19:[1,30]}),{20:[1,31]},{6:h,7:d,10:32,11:g},{1:[2,7],6:n,12:21,13:i,14:14,15:s,16:o,17:17,18:18,19:r,22:a},e(p,[2,14],{7:y,11:m}),e(f,[2,8]),e(f,[2,9]),e(f,[2,10]),e(u,[2,15]),e(u,[2,16]),e(u,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:y,11:m}),e(f,[2,11]),e(f,[2,12]),{21:[1,37]},e(u,[2,25]),e(u,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:(0,c.K)(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},"parseError"),parse:(0,c.K)(function(e){var t=this,n=[0],i=[],s=[null],o=[],r=this.table,a="",l=0,h=0,d=0,g=o.slice.call(arguments,1),u=Object.create(this.lexer),p={};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(p[y]=this.yy[y]);u.setInput(e,p),p.lexer=u,p.parser=this,void 0===u.yylloc&&(u.yylloc={});var m=u.yylloc;o.push(m);var f=u.options&&u.options.ranges;function b(){var e;return"number"!=typeof(e=i.pop()||u.lex()||1)&&(e instanceof Array&&(e=(i=e).pop()),e=t.symbols_[e]||e),e}"function"==typeof p.parseError?this.parseError=p.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,c.K)(function(e){n.length=n.length-2*e,s.length=s.length-e,o.length=o.length-e},"popStack"),(0,c.K)(b,"lex");for(var E,_,k,S,x,L,N,D,$,v={};;){if(k=n[n.length-1],this.defaultActions[k]?S=this.defaultActions[k]:(null==E&&(E=b()),S=r[k]&&r[k][E]),void 0===S||!S.length||!S[0]){var I="";for(L in $=[],r[k])this.terminals_[L]&&L>2&&$.push("'"+this.terminals_[L]+"'");I=u.showPosition?"Parse error on line "+(l+1)+":\n"+u.showPosition()+"\nExpecting "+$.join(", ")+", got '"+(this.terminals_[E]||E)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==E?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(I,{text:u.match,token:this.terminals_[E]||E,line:u.yylineno,loc:m,expected:$})}if(S[0]instanceof Array&&S.length>1)throw Error("Parse Error: multiple actions possible at state: "+k+", token: "+E);switch(S[0]){case 1:n.push(E),s.push(u.yytext),o.push(u.yylloc),n.push(S[1]),E=null,_?(E=_,_=null):(h=u.yyleng,a=u.yytext,l=u.yylineno,m=u.yylloc,d>0&&d--);break;case 2:if(N=this.productions_[S[1]][1],v.$=s[s.length-N],v._$={first_line:o[o.length-(N||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(N||1)].first_column,last_column:o[o.length-1].last_column},f&&(v._$.range=[o[o.length-(N||1)].range[0],o[o.length-1].range[1]]),void 0!==(x=this.performAction.apply(v,[a,h,l,p,S[1],s,o].concat(g))))return x;N&&(n=n.slice(0,-1*N*2),s=s.slice(0,-1*N),o=o.slice(0,-1*N)),n.push(this.productions_[S[1]][0]),s.push(v.$),o.push(v._$),D=r[n[n.length-2]][n[n.length-1]],n.push(D);break;case 3:return!0}}return!0},"parse")};function E(){this.yy={}}return b.lexer={EOF:1,parseError:(0,c.K)(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},"parseError"),setInput:(0,c.K)(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:(0,c.K)(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},"input"),unput:(0,c.K)(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},"unput"),more:(0,c.K)(function(){return this._more=!0,this},"more"),reject:(0,c.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,c.K)(function(e){this.unput(this.match.slice(e))},"less"),pastInput:(0,c.K)(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,c.K)(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,c.K)(function(){var e=this.pastInput(),t=Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},"showPosition"),test_match:(0,c.K)(function(e,t){var n,i,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack)for(var o in s)this[o]=s[o];return!1},"test_match"),next:(0,c.K)(function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var e,t,n,i,s=this._currentRules(),o=0;o<s.length;o++)if((n=this._input.match(this.rules[s[o]]))&&(!t||n[0].length>t[0].length)){if(t=n,i=o,this.options.backtrack_lexer){if(!1!==(e=this.test_match(n,s[o])))return e;if(!this._backtrack)return!1;t=!1;continue}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,s[i]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,c.K)(function(){var e=this.next();return e||this.lex()},"lex"),begin:(0,c.K)(function(e){this.conditionStack.push(e)},"begin"),popState:(0,c.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,c.K)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,c.K)(function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},"topState"),pushState:(0,c.K)(function(e){this.begin(e)},"pushState"),stateStackSize:(0,c.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,c.K)(function(e,t,n,i){switch(n){case 0:return e.getLogger().trace("Found comment",t.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:case 23:case 26:this.popState();break;case 5:e.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return e.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace("end icon"),this.popState();break;case 10:return e.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return e.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return e.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return e.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:case 15:case 16:case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 24:e.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return e.getLogger().trace("description:",t.yytext),"NODE_DESCR";case 27:return this.popState(),e.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),e.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),e.getLogger().trace("node end ...",t.yytext),"NODE_DEND";case 30:case 33:case 34:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 31:case 32:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 35:case 36:return e.getLogger().trace("Long description:",t.yytext),20}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}},(0,c.K)(E,"Parser"),E.prototype=b,b.Parser=E,new E}();p.parser=p;var y={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},m=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=y,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}static{(0,c.K)(this,"MindmapDB")}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(e){for(let t=this.nodes.length-1;t>=0;t--)if(this.nodes[t].level<e)return this.nodes[t];return null}getMindmap(){return this.nodes.length>0?this.nodes[0]:null}addNode(e,t,n,i){a.R.info("addNode",e,t,n,i);let s=!1;0===this.nodes.length?(this.baseLevel=e,e=0,s=!0):void 0!==this.baseLevel&&(e-=this.baseLevel,s=!1);let o=(0,r.D7)(),c=o.mindmap?.padding??r.UI.mindmap.padding;switch(i){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:c*=2}let l={id:this.count++,nodeId:(0,r.jZ)(t,o),level:e,descr:(0,r.jZ)(n,o),type:i,children:[],width:o.mindmap?.maxNodeWidth??r.UI.mindmap.maxNodeWidth,padding:c,isRoot:s},h=this.getParent(e);if(h)h.children.push(l),this.nodes.push(l);else if(s)this.nodes.push(l);else throw Error(`There can be only one root. No parent could be found for ("${l.descr}")`)}getType(e,t){switch(a.R.debug("In get type",e,t),e){case"[":return this.nodeType.RECT;case"(":return")"===t?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case"((":return this.nodeType.CIRCLE;case")":return this.nodeType.CLOUD;case"))":return this.nodeType.BANG;case"{{":return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(e,t){this.elements[e]=t}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;let t=(0,r.D7)(),n=this.nodes[this.nodes.length-1];e.icon&&(n.icon=(0,r.jZ)(e.icon,t)),e.class&&(n.class=(0,r.jZ)(e.class,t))}type2Str(e){switch(e){case this.nodeType.DEFAULT:return"no-border";case this.nodeType.RECT:return"rect";case this.nodeType.ROUNDED_RECT:return"rounded-rect";case this.nodeType.CIRCLE:return"circle";case this.nodeType.CLOUD:return"cloud";case this.nodeType.BANG:return"bang";case this.nodeType.HEXAGON:return"hexgon";default:return"no-border"}}assignSections(e,t){if(0===e.level?e.section=void 0:e.section=t,e.children)for(let[n,i]of e.children.entries()){let s=0===e.level?n%11:t;this.assignSections(i,s)}}flattenNodes(e,t){let n=(0,r.D7)(),i=["mindmap-node"];!0===e.isRoot?i.push("section-root","section--1"):void 0!==e.section&&i.push(`section-${e.section}`),e.class&&i.push(e.class);let s=i.join(" "),o=(0,c.K)(e=>{let t=(n.theme?.toLowerCase()??"").includes("redux");switch(e){case y.CIRCLE:return"mindmapCircle";case y.RECT:return"rect";case y.ROUNDED_RECT:return"rounded";case y.CLOUD:return"cloud";case y.BANG:return"bang";case y.HEXAGON:return"hexagon";case y.DEFAULT:return t?"rounded":"defaultMindmapNode";case y.NO_BORDER:default:return"rect"}},"getShapeFromType"),a={id:e.id.toString(),domId:"node_"+e.id.toString(),label:e.descr,labelType:"markdown",isGroup:!1,shape:o(e.type),width:e.width,height:e.height??0,padding:e.padding,cssClasses:s,cssStyles:[],look:n.look,icon:e.icon,x:e.x,y:e.y,level:e.level,nodeId:e.nodeId,type:e.type,section:e.section};if(t.push(a),e.children)for(let n of e.children)this.flattenNodes(n,t)}generateEdges(e,t){if(!e.children)return;let n=(0,r.D7)();for(let i of e.children){let s="edge";void 0!==i.section&&(s+=` section-edge-${i.section}`);let o=e.level+1;s+=` edge-depth-${o}`;let r={id:`edge_${e.id}_${i.id}`,start:e.id.toString(),end:i.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:n.look,classes:s,depth:e.level,section:i.section};t.push(r),this.generateEdges(i,t)}}getData(){let e=this.getMindmap(),t=(0,r.D7)();if(void 0!==(0,r.TM)().layout||(t.layout="cose-bilkent"),!e)return{nodes:[],edges:[],config:t};a.R.debug("getData: mindmapRoot",e,t),this.assignSections(e);let n=[],i=[];this.flattenNodes(e,n),this.generateEdges(e,i),a.R.debug(`getData: processed ${n.length} nodes and ${i.length} edges`);let s=new Map;for(let e of n)s.set(e.id,{shape:e.shape,width:e.width,height:e.height,padding:e.padding});return{nodes:n,edges:i,config:t,rootNode:e,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(s),type:"mindmap",diagramId:"mindmap-"+(crypto.randomUUID?crypto.randomUUID():function(e,t,n){let i=(e=e||{}).random??e.rng?.()??crypto.getRandomValues(l);if(i.length<16)throw Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){if((n=n||0)<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=i[e];return t}return function(e,t=0){return(h[e[t+0]]+h[e[t+1]]+h[e[t+2]]+h[e[t+3]]+"-"+h[e[t+4]]+h[e[t+5]]+"-"+h[e[t+6]]+h[e[t+7]]+"-"+h[e[t+8]]+h[e[t+9]]+"-"+h[e[t+10]]+h[e[t+11]]+h[e[t+12]]+h[e[t+13]]+h[e[t+14]]+h[e[t+15]]).toLowerCase()}(i)}(void 0,void 0,void 0))}}getLogger(){return a.R}},f=(0,c.K)(async(e,t,n,c)=>{a.R.debug("Rendering mindmap diagram\n"+e);let l=c.db,h=l.getData(),d=(0,i.A)(t,h.config.securityLevel);if(h.type=c.type,h.layoutAlgorithm=(0,o.q7)(h.config.layout,{fallback:"cose-bilkent"}),h.diagramId=t,!l.getMindmap())return;h.nodes.forEach(e=>{"rounded"===e.shape?(e.radius=15,e.taper=15,e.stroke="none",e.width=0,e.padding=15):"circle"===e.shape?e.padding=10:"rect"===e.shape?(e.width=0,e.padding=10):"hexagon"===e.shape&&(e.width=0,e.height=0)}),await (0,o.XX)(h,d);let{themeVariables:g}=(0,r.zj)(),{useGradient:u,gradientStart:p,gradientStop:y}=g;if(u&&p&&y){let e=d.attr("id"),t=d.append("defs").append("linearGradient").attr("id",`${e}-gradient`).attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");t.append("stop").attr("offset","0%").attr("stop-color",p).attr("stop-opacity",1),t.append("stop").attr("offset","100%").attr("stop-color",y).attr("stop-opacity",1)}(0,s.P)(d,h.config.mindmap?.padding??r.UI.mindmap.padding,"mindmapDiagram",h.config.mindmap?.useMaxWidth??r.UI.mindmap.useMaxWidth)},"draw"),b=(0,c.K)(e=>{let{theme:t,look:n}=e,i="";for(let t=0;t<e.THEME_COLOR_LIMIT;t++)e["lineColor"+t]=e["lineColor"+t]||e["cScaleInv"+t],(0,d.A)(e["lineColor"+t])?e["lineColor"+t]=(0,g.A)(e["lineColor"+t],20):e["lineColor"+t]=(0,u.A)(e["lineColor"+t],20);for(let s=0;s<e.THEME_COLOR_LIMIT;s++){let o=""+("neo"===n?Math.max(10-(s-1)*2,2):17-3*s);i+=`
|
|
2
|
+
.section-${s-1} rect, .section-${s-1} path, .section-${s-1} circle, .section-${s-1} polygon, .section-${s-1} path {
|
|
3
|
+
fill: ${e["cScale"+s]};
|
|
4
|
+
}
|
|
5
|
+
.section-${s-1} text {
|
|
6
|
+
fill: ${e["cScaleLabel"+s]};
|
|
7
|
+
}
|
|
8
|
+
.section-${s-1} span {
|
|
9
|
+
color: ${e["cScaleLabel"+s]};
|
|
10
|
+
}
|
|
11
|
+
.node-icon-${s-1} {
|
|
12
|
+
font-size: 40px;
|
|
13
|
+
color: ${e["cScaleLabel"+s]};
|
|
14
|
+
}
|
|
15
|
+
.section-edge-${s-1}{
|
|
16
|
+
stroke: ${e["cScale"+s]};
|
|
17
|
+
}
|
|
18
|
+
.edge-depth-${s-1}{
|
|
19
|
+
stroke-width: ${o};
|
|
20
|
+
}
|
|
21
|
+
.section-${s-1} line {
|
|
22
|
+
stroke: ${e["cScaleInv"+s]} ;
|
|
23
|
+
stroke-width: 3;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.disabled, .disabled circle, .disabled text {
|
|
27
|
+
fill: lightgray;
|
|
28
|
+
}
|
|
29
|
+
.disabled text {
|
|
30
|
+
fill: #efefef;
|
|
31
|
+
}
|
|
32
|
+
[data-look="neo"].mindmap-node.section-${s-1} rect, [data-look="neo"].mindmap-node.section-${s-1} path, [data-look="neo"].mindmap-node.section-${s-1} circle, [data-look="neo"].mindmap-node.section-${s-1} polygon {
|
|
33
|
+
fill: ${"redux"===t||"redux-dark"===t||"neutral"===t?e.mainBkg:e["cScale"+s]};
|
|
34
|
+
stroke: ${"redux"===t||"redux-dark"===t?e.nodeBorder:e["cScale"+s]};
|
|
35
|
+
stroke-width: ${e.strokeWidth??2}px;
|
|
36
|
+
}
|
|
37
|
+
[data-look="neo"].section-edge-${s-1}{
|
|
38
|
+
stroke: ${t?.includes("redux")||"neo-dark"===t?e.nodeBorder:e["cScale"+s]};
|
|
39
|
+
}
|
|
40
|
+
[data-look="neo"].mindmap-node.section-${s-1} text {
|
|
41
|
+
fill: ${"redux"===t||"redux-dark"===t?e.nodeBorder:e["cScaleLabel"+("neutral"===t?1:s)]};
|
|
42
|
+
}
|
|
43
|
+
`}return i},"genSections"),E=(0,c.K)((e,t,n)=>{let i="";for(let s=0;s<e;s++)i+=`
|
|
44
|
+
[data-look="neo"].mindmap-node.section-${s-1} rect, [data-look="neo"].mindmap-node.section-${s-1} path, [data-look="neo"].mindmap-node.section-${s-1} circle, [data-look="neo"].mindmap-node.section-${s-1} polygon {
|
|
45
|
+
stroke: url(${t}-gradient);
|
|
46
|
+
fill: ${n};
|
|
47
|
+
}
|
|
48
|
+
.section-${s-1} line {
|
|
49
|
+
stroke-width: 0;
|
|
50
|
+
}`;return i},"genGradient"),_={get db(){return new m},renderer:{draw:f},parser:p,styles:(0,c.K)(e=>{let{theme:t}=e,n=e.svgId,i=e.dropShadow?e.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none";return`
|
|
51
|
+
.edge {
|
|
52
|
+
stroke-width: 3;
|
|
53
|
+
}
|
|
54
|
+
${b(e)}
|
|
55
|
+
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
|
|
56
|
+
fill: ${e.git0};
|
|
57
|
+
}
|
|
58
|
+
.section-root text {
|
|
59
|
+
fill: ${e.gitBranchLabel0};
|
|
60
|
+
}
|
|
61
|
+
.section-root span {
|
|
62
|
+
color: ${t?.includes("redux")?e.nodeBorder:e.gitBranchLabel0};
|
|
63
|
+
}
|
|
64
|
+
.icon-container {
|
|
65
|
+
height:100%;
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
.edge {
|
|
71
|
+
fill: none;
|
|
72
|
+
}
|
|
73
|
+
.mindmap-node-label {
|
|
74
|
+
dy: 1em;
|
|
75
|
+
alignment-baseline: middle;
|
|
76
|
+
text-anchor: middle;
|
|
77
|
+
dominant-baseline: middle;
|
|
78
|
+
text-align: center;
|
|
79
|
+
}
|
|
80
|
+
[data-look="neo"].mindmap-node {
|
|
81
|
+
filter: ${i};
|
|
82
|
+
}
|
|
83
|
+
[data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon {
|
|
84
|
+
fill: ${t?.includes("redux")?e.mainBkg:e.git0};
|
|
85
|
+
}
|
|
86
|
+
[data-look="neo"].mindmap-node.section-root .text-inner-tspan {
|
|
87
|
+
fill: ${t?.includes("redux")?e.nodeBorder:e["cScaleLabel"+ +("neutral"===t)]};
|
|
88
|
+
}
|
|
89
|
+
${e.useGradient&&n&&e.mainBkg?E(e.THEME_COLOR_LIMIT,n,e.mainBkg):""}
|
|
90
|
+
`},"getStyles")}}}]);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! LICENSE: xe.da8dcc2015.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["xe"],{wA(e,t,n){var r=n("j"),l=n("H"),o=n("rm"),i=n("Go"),s=n("t3"),a=n("Ir"),c=n("z"),u=n("oj");function d(e){let{rootPath:t,activeRepo:n,onSelectRepo:d,repos:h,scanning:p,onRefreshRepos:f}=e,[m,g]=(0,l.J0)(!1),[b,y]=(0,l.J0)(""),x=(0,l.li)(null),w=function(e){if(!e)return"workspace root";let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length>0?t[t.length-1]:"workspace root"}(t),v=e=>"."===e?w:e;(0,u.W)(x,()=>g(!1));let k=h.filter(e=>!b.trim()||v(e).toLowerCase().includes(b.toLowerCase()));return(0,r.FD)("div",{className:"relative",ref:x,children:[(0,r.FD)("button",{type:"button",onClick:()=>g(!m),title:"Switch git project",className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 rounded transition-colors text-xs text-ink/80 font-medium",children:[(0,r.Y)(o.A,{size:12,className:"text-ink/60"}),(0,r.Y)("span",{className:"truncate max-w-[110px]",children:"."===n?w:n.split("/").pop()}),(0,r.Y)(i.A,{size:12,className:"text-ink/40"})]}),m&&(0,r.FD)("div",{className:"absolute top-full left-0 mt-1 w-52 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[(0,r.FD)("div",{className:"px-2 py-1.5 border-b border-ink/10 flex items-center space-x-1.5",children:[(0,r.Y)(s.A,{size:11,className:"text-ink/40 flex-shrink-0"}),(0,r.Y)("input",{type:"text",value:b,onChange:e=>y(e.currentTarget.value),placeholder:"Search repos...",title:"Search repositories",className:"w-full bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),b&&(0,r.Y)("button",{type:"button",onClick:()=>y(""),title:"Clear search",className:"text-ink/40 hover:text-ink flex-shrink-0",children:"×"}),(0,r.Y)("button",{type:"button",onClick:f,title:"Refresh nested repos",disabled:p,className:"text-ink/40 hover:text-ink flex-shrink-0 transition-colors disabled:opacity-40 disabled:hover:text-ink/40",children:(0,r.Y)(a.A,{size:11,className:p?"animate-spin":""})})]}),(0,r.Y)("div",{className:"max-h-48 scrollbar-overlay-container scrollbar-overlay-static py-1",children:0===k.length?(0,r.Y)("div",{className:"px-3 py-2 text-ink/40 italic",children:"No repos found"}):k.map(e=>(0,r.FD)("button",{type:"button",onClick:()=>{d(e),g(!1),y("")},title:v(e),className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,r.Y)("span",{className:"truncate",children:v(e)}),n===e&&(0,r.Y)(c.A,{size:12,className:"text-ink"})]},e))})]})]})}n.d(t,{I:()=>d})},nZ(e,t,n){n.d(t,{TerminalPanel:()=>I});var r=n("j"),l=n("H"),o=n("FL"),i=n("As"),s=n("SS"),a=n("oS");function c(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`t-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function u(e){return JSON.stringify(e)}var d=n("SW"),h=n("zm"),p=n("N"),f=n("t"),m=n("Wb0"),g=n("wA");let b={connecting:"CONNECTING",running:"LIVE",exited:"EXITED",error:"ERROR"},y={connecting:"bg-warning/10 text-warning border-warning/20",running:"bg-success/10 text-success border-success/20",exited:"bg-ink/5 text-ink/60 border-ink/15",error:"bg-error/10 text-error border-error/20"};function x(e){let{status:t,exitCode:n,rootPath:l,activeRepo:o,onSelectRepo:i,repos:s,reposScanning:a,onRefreshRepos:c,cwd:u,shell:d,gitBranch:h,onRestart:x}=e,w=d?d.split("/").pop():"";return(0,r.FD)("div",{className:"h-10 px-3 border-b border-ink/10 bg-paper flex items-center justify-between flex-shrink-0 select-none",children:[(0,r.FD)("div",{className:"flex items-center space-x-2 min-w-0",children:[(0,r.FD)("div",{className:"flex items-center space-x-1.5",children:[(0,r.Y)(p.A,{size:14,className:"text-ink/80 flex-shrink-0"}),(0,r.Y)("span",{className:"text-xs font-semibold tracking-wider text-ink uppercase",children:"Terminal"})]}),(0,r.FD)("span",{className:`inline-flex items-center space-x-1 px-1.5 py-0.5 rounded text-[10px] font-mono border ${y[t]}`,title:"exited"===t&&null!==n?`Shell exited with code ${n}`:void 0,children:["connecting"===t&&(0,r.Y)(f.A,{size:10,className:"animate-spin"}),(0,r.Y)("span",{children:"exited"===t&&null!==n?`EXIT ${n}`:b[t]})]}),(0,r.Y)(g.I,{rootPath:l,activeRepo:o,onSelectRepo:i,repos:s,scanning:a,onRefreshRepos:c}),(0,r.Y)("button",{type:"button",onClick:x,title:"Kill this shell and start a new one",className:"p-1 rounded text-ink/50 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:(0,r.Y)(m.A,{size:12})})]}),(0,r.FD)("span",{className:"hidden sm:flex items-center space-x-2 text-[10px] font-mono text-ink/40 flex-shrink-0 min-w-0",children:[u&&(0,r.Y)("span",{className:"truncate max-w-[280px]",title:u,children:u}),h&&(0,r.Y)("span",{children:h}),w&&(0,r.Y)("span",{children:w})]})]})}var w=n("XT");let v=[{label:"bun build",cmd:"bun run build"},{label:"bun test",cmd:"bun test"},{label:"git status",cmd:"git status -s"},{label:"git diff",cmd:"git diff"},{label:"ls -la",cmd:"ls -la"},{label:"pwd",cmd:"pwd"},{label:"bun -v",cmd:"bun --version"}];function k(e){let{onSelectCommand:t,disabled:n}=e;return(0,r.FD)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-1.5 bg-paper border-b border-ink/10 flex-shrink-0",children:[(0,r.FD)("div",{className:"flex items-center space-x-1 text-[10px] font-mono text-ink/50 uppercase tracking-wider flex-shrink-0 select-none",children:[(0,r.Y)(w.A,{size:11,className:"text-warning"}),(0,r.Y)("span",{children:"Quick:"})]}),v.map(e=>(0,r.Y)("button",{type:"button",disabled:n,onClick:()=>t(e.cmd),className:"px-2 py-0.5 rounded text-[10px] font-mono bg-canvas hover:bg-ink/5 active:bg-ink/10 text-ink/80 hover:text-ink border border-ink/15 transition-all whitespace-nowrap disabled:opacity-40 cursor-pointer shadow-2xs",children:e.label},e.cmd))]})}var N=n("G"),S=n("zi");let R=/^#?([0-9a-f]{3})$/i,C=/^#?([0-9a-f]{6})$/i,Y=/^#?([0-9a-f]{8})$/i;function F(e){let t=e.trim(),n=R.exec(t);if(n){let[e,t,r]=n[1].split("");return{r:parseInt(e+e,16),g:parseInt(t+t,16),b:parseInt(r+r,16),a:1}}let r=C.exec(t);if(r){let e=parseInt(r[1],16);return{r:e>>16&255,g:e>>8&255,b:255&e,a:1}}let l=Y.exec(t);if(l){let e=parseInt(l[1],16);return{r:e>>>24&255,g:e>>16&255,b:e>>8&255,a:(255&e)/255}}return null}function A(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function z(e,t,n){let r=F(e),l=F(t);if(!r||!l)return e;let o=l.a*n;return function(e){let{r:t,g:n,b:r}=e;return`#${A(t)}${A(n)}${A(r)}`}({r:r.r*(1-o)+l.r*o,g:r.g*(1-o)+l.g*o,b:r.b*(1-o)+l.b*o,a:1})}var D=n("XS");function M(e){let t,n=(0,D.eW)(e),{canvas:r,ink:l}=n;return{background:r,foreground:l,cursor:n.meta,cursorAccent:r,selectionBackground:z(r,l,.28),selectionForeground:l,black:z(r,l,.2),red:n.error,green:n.success,yellow:n.warning,blue:n.info,magenta:n.meta,cyan:z(n.info,n.success,.5),white:z(r,l,.75),brightBlack:z(r,l,.5),brightRed:z(n.error,l,.2),brightGreen:z(n.success,l,.2),brightYellow:z(n.warning,l,.2),brightBlue:z(n.info,l,.2),brightMagenta:z(n.meta,l,.2),brightCyan:(t=z(n.info,n.success,.5),z(t,l,.2)),brightWhite:z(r,l,.92)}}let P={device:{char:{width:9,height:17,left:0,top:0},cell:{width:9,height:17},canvas:{width:0,height:0}},css:{canvas:{width:0,height:0},cell:{width:9,height:17}}};async function B(e,t,r,l){var o,i;let s,a,c,u=await n.e("f").then(n.bind(n,"JX")),d=await n.e("xnl").then(n.bind(n,"r3")),h=u.Terminal||u.default?.Terminal||u.default,p=d.FitAddon||d.default?.FitAddon||d.default;if(!h||!p||l())return null;try{let e=p?.prototype;if(e&&!e.__safePatched){e.__safePatched=!0;let t=e.proposeDimensions;e.proposeDimensions=function(){try{let e=this._terminal?._core;if(!e?._renderService)return;let n=e._renderService.dimensions;if(!n?.css?.cell?.width||!n?.css?.cell?.height)return;return t?.call(this)}catch{return}}}}catch{}let f=new h({cursorBlink:!0,cursorStyle:"block",fontSize:12,lineHeight:1.25,fontFamily:"'Fira Code', 'FiraCode Nerd Font Mono', 'FiraCode Nerd Font', 'JetBrainsMono Nerd Font', 'JetBrainsMono NF', 'JetBrains Mono Nerd Font', 'Hack Nerd Font', 'MesloLGS NF', 'MesloLGM Nerd Font', 'CaskaydiaCove Nerd Font', 'SauceCodePro Nerd Font', 'Symbols Nerd Font Mono', 'Symbols Nerd Font', 'PowerlineSymbols', Menlo, Monaco, 'Courier New', monospace",theme:M(t),scrollback:1e4,scrollSensitivity:1.5,fastScrollSensitivity:5,smoothScrollDuration:0,allowProposedApi:!0});f.open(e);try{let e=f?._core;if(e?._renderService){let t=Object.getPrototypeOf(e._renderService),n=Object.getOwnPropertyDescriptor(t,"dimensions");if(n?.get&&!t.__safePatched){t.__safePatched=!0;let e=n.get;Object.defineProperty(t,"dimensions",{get(){try{if(!this._renderer?.value)return P;return e.call(this)}catch{return P}},configurable:!0,enumerable:!0})}}}catch{}try{let e=await n.e("ms").then(n.bind(n,"Az")),t=e.WebglAddon||e.default?.WebglAddon||e.default;if(t){let e=new t;e.onContextLoss(()=>e.dispose()),f.loadAddon(e)}}catch{}let m=new p;f.loadAddon(m),f.attachCustomKeyEventHandler(e=>{var t,n;return t=f,"keydown"!==(n=e).type||!n.shiftKey||("PageUp"===n.key?(t.scrollPages(-1),!1):"PageDown"===n.key?(t.scrollPages(1),!1):"Home"===n.key?(t.scrollToTop(),!1):"End"===n.key?(t.scrollToBottom(),!1):"ArrowUp"===n.key?(t.scrollLines(-1),!1):"ArrowDown"!==n.key||(t.scrollLines(1),!1))});let g=[f.onScroll(()=>{let e=f.buffer.active;r.onScrolledUpChange(e.viewportY<e.baseY)}),f.onData(e=>r.onInput(e)),f.onBinary(e=>r.onBinaryInput(e)),f.onResize(e=>{let{cols:t,rows:n}=e;w||r.onGridChange(t,n)})],b=!1,y=null,x=null,w=!1,v=()=>{if(l()||e.clientWidth<=0||e.clientHeight<=0)return;let t=f._core,n=t?._renderService?.dimensions;if(n?.css?.cell?.width&&n?.css?.cell?.height)try{m.fit()}catch{}},k=()=>{f.write("",()=>{l()||(w=!1,v())})},N=()=>{if(b||l()||e.clientWidth<=0||e.clientHeight<=0)return;let t=f._core;t?._renderService?.dimensions?.css?.cell?.width&&(b=!0,r.onReady(f.cols,f.rows),f.focus())},S=new ResizeObserver(()=>{y&&clearTimeout(y),y=setTimeout(()=>{v(),N()},35)});S.observe(e);let R=(o=e,i=f,s=0,a=e=>{1===e.touches.length&&(s=e.touches[0].clientY)},c=e=>{if(1!==e.touches.length)return;let t=s-e.touches[0].clientY;16>Math.abs(t)||(i.scrollLines(Math.trunc(t/16)),s=e.touches[0].clientY)},o.addEventListener("touchstart",a,{passive:!0}),o.addEventListener("touchmove",c,{passive:!0}),()=>{o.removeEventListener("touchstart",a),o.removeEventListener("touchmove",c)});return x=requestAnimationFrame(()=>{v(),N()}),{term:f,fitAddon:m,writeReplay:(e,t,n)=>{(w=!0,(f.cols!==t||f.rows!==n)&&f.resize(t,n),0===e.length)?k():f.write(e,k)},dispose(){for(let e of(null!==x&&cancelAnimationFrame(x),clearTimeout(y??void 0),R(),g))e.dispose();S.disconnect();try{m.dispose()}catch{}try{f.dispose()}catch{}}}}let $=(0,N.Rf)((e,t)=>{let{onInput:n,onBinaryInput:o,onGridChange:i,onReady:s}=e,{theme:a}=(0,h.DP)(),c=(0,l.li)(null),u=(0,l.li)(null),[d,p]=(0,l.J0)(!1),f=(0,l.li)(n);f.current=n;let m=(0,l.li)(o);m.current=o;let g=(0,l.li)(i);g.current=i;let b=(0,l.li)(s);b.current=s;let y=(0,l.li)(a);y.current=a,(0,l.vJ)(()=>{let e=u.current?.term;e&&(e.options.theme=M(a),e.refresh(0,e.rows-1))},[a]),(0,l.Yn)(t,()=>({write(e){u.current?.term.write(e)},writeReplay(e,t,n){u.current?.writeReplay(e,t,n)},reset(){u.current?.term.reset()},focus(){u.current?.term.focus()}}),[]);let x=(0,l.hb)(()=>{u.current?.term.scrollToBottom(),p(!1)},[]);return(0,l.vJ)(()=>{let e=c.current;if(!e)return;let t=!1;return B(e,y.current,{onInput:e=>f.current(e),onBinaryInput:e=>m.current(e),onGridChange:(e,t)=>g.current(e,t),onReady:(e,t)=>b.current(e,t),onScrolledUpChange:p},()=>t).then(e=>{if(e){if(t)return void e.dispose();u.current=e}}),()=>{t=!0,u.current?.dispose(),u.current=null}},[]),(0,r.FD)("div",{className:"relative flex-1 w-full h-full bg-canvas overflow-hidden",children:[(0,r.Y)("div",{ref:c,className:"w-full h-full cursor-text p-1.5",style:{height:"100%",width:"100%"}}),d&&(0,r.FD)("button",{type:"button",onClick:x,className:"absolute bottom-3 right-4 z-20 flex items-center space-x-1.5 px-2.5 py-1 bg-paper hover:bg-canvas text-ink border border-ink/20 rounded-full shadow-lg text-[11px] font-mono transition-all animate-fade-in cursor-pointer active:scale-95",title:"Scroll to latest output (Shift+End)",children:[(0,r.Y)(S.A,{size:12,className:"text-warning"}),(0,r.Y)("span",{children:"Latest"})]})]})});$.displayName="RealtimeXtermView";let T=new TextEncoder;function I(e){let{className:t="",enabled:n=!0,rootPath:p,showHeader:f=!0}=e,m=(0,l.li)(null),{isDark:g}=(0,h.DP)(),{activeRepo:b,setActiveRepo:y}=(0,d.Og)(p,"terminal.activeRepo"),{repos:w,scanning:v,rescan:N}=(0,d.Ml)(p,n),S=(0,l.li)(null),{status:R,cwd:C,shell:Y,exitCode:F,error:A,systemInfo:z,attach:D,resize:M,input:P,restart:B}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{sessionId:t,ready:n}=(0,i.O)(),[r,d]=(0,o.bL)("terminal.id",""),[h,p]=(0,l.J0)("connecting"),[f,m]=(0,l.J0)(""),[g,b]=(0,l.J0)(""),[y,x]=(0,l.J0)(null),[w,v]=(0,l.J0)(null),[k,N]=(0,l.J0)({gitBranch:"main"}),S=(0,l.li)(null),R=(0,l.li)(null),C=(0,l.li)(e.onOutput);C.current=e.onOutput;let Y=(0,l.li)(e.onReplay);Y.current=e.onReplay;let F=(0,l.li)(e.onRestart);F.current=e.onRestart;let A=(0,l.li)(e.root);A.current=e.root;let z=(0,l.li)(e.repo);z.current=e.repo;let D=(0,l.li)(e.theme);D.current=e.theme;let M=(0,l.li)(d);M.current=d;let P=(0,l.li)(null);(0,l.vJ)(()=>{!n||(0,s.WV)(t,"terminal.id")||M.current(c())},[n,t]),(0,l.vJ)(()=>{var e;let t,l,o,i,s,c,d,h,f,g,y,w,k,N,F;if(!n||!r)return;p("connecting"),v(null),x(null);let M=(e={onReady(e){p("running"),m(e.cwd),b(e.shell),x(null)},onReplay(e,t){Y.current?.(e,t)},onOutput(e){C.current?.(e)},onExit(e){p("exited"),x(e)},onError(e,t){p("error"),v(`${e}: ${t}`)},onConnectionChange(e){e||p("connecting")}},t=null,l=null,o=0,i=!1,s=!1,c=!1,d=null,h=[],f=0,g=null,y=()=>{let n,p=new WebSocket((n="https:"===window.location.protocol?"wss:":"ws:",`${n}//${window.location.host}/api/terminal/${encodeURIComponent(r)}/ws`));p.binaryType="arraybuffer",t=p,p.onopen=()=>{!s&&(o=0,i=!0,e.onConnectionChange(!0),d&&p.send(u(d)))},p.onmessage=e=>{if(s)return;if(e.data instanceof ArrayBuffer)return void k(new Uint8Array(e.data));let t=function(e){var t;let n=function(e){try{return JSON.parse(e)}catch{return null}}(e);if(!(0,a.u)(n))return null;if("ready"===n.t){if("string"!=typeof n.id||"string"!=typeof n.cwd)return null;let e="number"==typeof n.replayBytes?n.replayBytes:0;return{...n,t:"ready",replayBytes:e}}return"exit"===n.t?{t:"exit",exitCode:"number"==typeof n.exitCode?n.exitCode:null,signal:"string"==typeof n.signal?n.signal:null}:"error"===n.t&&"string"==typeof n.message?{t:"error",code:"capacity"===(t=n.code)||"cwd"===t||"shell"===t||"spawn"===t?t:"unknown",message:n.message}:null}("string"==typeof e.data?e.data:"");t&&w(t)},p.onclose=()=>{t=null,s||(e.onConnectionChange(!1),c=!1,h=[],f=0,g=null,!i||(o+=1)>4||(l=setTimeout(()=>{l=null,s||y()},Math.min(500*2**(o-1),8e3))))},p.onerror=()=>{}},w=t=>{if("ready"===t.t){c=!0,g=t,f=t.replayBytes,h=[],e.onReady(t),0===f&&N();return}"exit"===t.t?e.onExit(t.exitCode,t.signal):e.onError(t.code,t.message)},k=t=>{f<=0?e.onOutput(t):(h.push(t),(f-=t.length)>0||N())},N=()=>{let t=g,n=h;g=null,h=[],f=0,t&&e.onReplay(1===n.length?n[0]:function(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}(n),t)},y(),F=e=>{let n=t;n&&n.readyState===WebSocket.OPEN&&n.send(u(e))},{attach(e,t,n,r,l){if(c)return;let o={t:"attach",cols:e,rows:t};n&&(o.root=n),r&&(o.repo=r),l&&(o.theme=l),d=o,F(o)},resize(e,t){F({t:"resize",cols:e,rows:t})},input(e){let n=t;n&&n.readyState===WebSocket.OPEN&&n.send(e)},close(){F({t:"close"})},release(){s=!0,null!==l&&(clearTimeout(l),l=null);let e=t;t=null,e&&(e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null,e.close())}});S.current=M;let P=R.current;return P&&M.attach(P.cols,P.rows,A.current,z.current,D.current),()=>{M.release(),S.current=null}},[n,r]);let B=(0,l.hb)(()=>{S.current?.close(),F.current?.(),M.current(c())},[]);(0,l.vJ)(()=>{if(!n)return;let t=e.root;if(!t)return;let r=`${t}\0${e.repo??"."}`;if(null===P.current){P.current=r;return}P.current!==r&&(P.current=r,B())},[n,e.root,e.repo,B]),(0,l.vJ)(()=>{let t=e.root,n=e.repo;if(!t)return;let r=new URLSearchParams({root:t});n&&"."!==n&&r.set("repo",n);let l=!1;return fetch(`/api/terminal/run?${r.toString()}`).then(e=>e.ok?e.json():null).then(e=>{!l&&e?.gitBranch&&N({gitBranch:e.gitBranch})}).catch(()=>{}),()=>{l=!0}},[e.root,e.repo]);let $=(0,l.hb)((e,t)=>{R.current={cols:e,rows:t},S.current?.attach(e,t,A.current,z.current,D.current)},[]);return{status:h,cwd:f,shell:g,exitCode:y,error:w,systemInfo:k,attach:$,resize:(0,l.hb)((e,t)=>{R.current={cols:e,rows:t},S.current?.resize(e,t)},[]),input:(0,l.hb)(e=>{S.current?.input(e)},[]),restart:B}}({root:n?p:void 0,repo:b,theme:g?"dark":"light",onOutput:(0,l.hb)(e=>{m.current?.write(e)},[]),onReplay:(0,l.hb)((e,t)=>{m.current?.writeReplay(e,t.replayCols,t.replayRows)},[]),onRestart:(0,l.hb)(()=>{m.current?.reset()},[])}),I=(0,l.hb)((e,t)=>{S.current={cols:e,rows:t},D(e,t)},[D]),J=(0,l.hb)((e,t)=>{let n=S.current;S.current={cols:e,rows:t},n&&M(e,t)},[M]),L=(0,l.hb)(e=>{P(T.encode(e))},[P]),O=(0,l.hb)(e=>{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=1)t[n]=255&e.charCodeAt(n);P(t)},[P]),E=(0,l.hb)(e=>{P(T.encode(`${e}\r`)),m.current?.focus()},[P]),_=(0,l.hb)(()=>{B()},[B]);return n?(0,r.FD)("div",{className:`flex flex-col h-full w-full bg-paper text-ink overflow-hidden ${t}`,children:[f&&(0,r.Y)(x,{status:R,exitCode:F,rootPath:p,activeRepo:b,onSelectRepo:y,repos:w,reposScanning:v,onRefreshRepos:N,cwd:C,shell:Y,gitBranch:z.gitBranch,onRestart:_}),(0,r.Y)(k,{onSelectCommand:E,disabled:"running"!==R}),A&&(0,r.Y)("div",{className:"px-3 py-1.5 border-b border-error/20 bg-error/5 text-[11px] font-mono text-error flex-shrink-0",children:A}),(0,r.Y)("div",{className:"flex-1 w-full min-h-0 bg-canvas overflow-hidden",children:(0,r.Y)($,{ref:m,onInput:L,onBinaryInput:O,onReady:I,onGridChange:J})})]}):(0,r.Y)("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:(0,r.Y)("span",{className:"text-xs font-mono",children:"No session selected"})})}},SW(e,t,n){n.d(t,{gv:()=>c,Ml:()=>d,Og:()=>u});var r=n("G"),l=n("FL"),o=n("oS");let i={repos:["."],scanning:!1},s=(e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)},a=function(e){let{fetch:t,scheduler:n=s}=e,r=new Map;function l(e){let t=r.get(e);return t||(t={snapshot:i,loaded:!1,listeners:new Set,controller:null,cancelRetry:null,pending:null},r.set(e,t)),t}function a(e,t){let n=r.get(e);if(!n)return;let l={...n.snapshot,...t};if(l.repos!==n.snapshot.repos||l.scanning!==n.snapshot.scanning)for(let e of(n.snapshot=l,n.listeners))e()}function c(e){e.cancelRetry?.(),e.cancelRetry=null}function u(e,r){let i=l(e);i.controller?.abort();let s=new AbortController;i.controller=s,a(e,{scanning:!0});let d=new URLSearchParams({reposOnly:"1"});e&&d.set("root",e),r&&d.set("rescan","1"),d.set("t",String(Date.now()));let h=(async()=>{let r=await t(`/api/fs/git?${d.toString()}`).catch(()=>null);if(i.controller!==s)return;i.controller=null;let l=(0,o.u)(r)&&Array.isArray(r.repos)?r.repos:null;if(!l)return void a(e,{scanning:!1});let h=(0,o.u)(r)&&!0===r.reposPending;i.loaded=!0,a(e,{repos:l.filter(e=>"string"==typeof e),scanning:h}),h?(c(i),i.cancelRetry=n(()=>{i.cancelRetry=null,0!==i.listeners.size&&u(e,!1)},1500)):c(i)})();return i.pending=h,h}return{snapshot:e=>r.get(e)?.snapshot??i,settled:e=>r.get(e)?.pending??Promise.resolve(),subscribe:function(e,t){let n=l(e);return n.listeners.add(t),null===n.controller&&null===n.cancelRetry&&(!n.loaded||n.snapshot.scanning)&&u(e,!1),()=>{n.listeners.delete(t),n.listeners.size>0||(n.controller?.abort(),n.controller=null,c(n))}},rescan:e=>void u(e,!0)}}({fetch:async e=>(await fetch(e)).json()});function c(e,t){return"."!==e||t.includes(".")?e:t[0]??"."}function u(e,t){let[n,o,i]=(0,l.bL)(t,null),s=e??"",a=(0,r.li)(s);a.current=s;let c=(0,r.li)(o);c.current=o;let u=(0,r.hb)(e=>{c.current({root:a.current,repo:e})},[]);return{activeRepo:n&&"object"==typeof n&&n.root===s&&"string"==typeof n.repo&&n.repo?n.repo:".",setActiveRepo:u,ready:i}}function d(e,t){let n=e??"",l=(0,r.hb)(e=>t?a.subscribe(n,e):()=>{},[n,t]),o=(0,r.hb)(()=>t?a.snapshot(n):i,[n,t]),s=(0,r.rz)(l,o),c=(0,r.hb)(()=>{t&&a.rescan(n)},[n,t]);return{repos:s.repos,scanning:s.scanning,rescan:c}}},rm(e,t,n){let r=(0,n("y").A)({name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]});n.d(t,{},{A:r})},Wb0(e,t,n){let r=(0,n("y").A)({name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]});n.d(t,{},{A:r})}}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! LICENSE: xn.
|
|
2
|
-
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["xn"],{PB(e,t,n){n.d(t,{ExtensionDialog:()=>g});var r=n("j"),i=n("H");let a=(0,n("y").A)({name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]});var s=n("p"),l=n("N"),o=n("SR"),c=n("WO"),d=n("m"),p=n("tN"),m=n("S");function x(e){let{title:t,methodLabel:n,badge:i,icon:a,onCancel:s}=e;return(0,r.FD)("div",{className:"flex items-center justify-between border-b border-ink/8 bg-canvas/40 px-5 py-3.5",children:[(0,r.FD)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,r.Y)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-ink/12 bg-paper text-ink shadow-xs",children:a}),(0,r.FD)("div",{className:"min-w-0",children:[(0,r.FD)("div",{className:"flex items-center gap-2",children:[(0,r.Y)("h3",{className:"truncate text-[14px] font-semibold tracking-tight text-ink",children:t||n}),(0,r.FD)("span",{className:"flex items-center gap-1 rounded-full border border-ink/10 bg-paper px-2 py-0.5 font-mono text-[9px] font-medium tracking-wider text-ink/60 uppercase",children:[(0,r.Y)(p.A,{size:9,className:"text-ink/40"}),i]})]}),(0,r.Y)("p",{className:"mt-0.5 text-[11px] text-ink/50",children:"Autonomous agent inquiry requiring user confirmation"})]})]}),(0,r.Y)("button",{type:"button",onClick:s,"aria-label":"Close dialog (Esc)",title:"Cancel (Esc)",className:"flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-ink/10 text-ink/45 transition-colors hover:border-ink/25 hover:bg-ink/5 hover:text-ink",children:(0,r.Y)(m.A,{size:14})})]})}var u=n("V");function h(e){let{options:t,optionDetails:n,selectedOption:i,customValue:a,onCustomChange:s,customInputRef:l,onSelect:o,onConfirmOption:c}=e;return(0,r.FD)("div",{className:"space-y-2",children:[(0,r.FD)("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[(0,r.Y)("span",{children:"Available Options"}),(0,r.FD)("span",{className:"font-mono text-[10px] text-ink/40",children:["Press [1-",Math.min(9,t.length),"] to choose"]})]}),(0,r.Y)("div",{className:"grid gap-2",role:"radiogroup",children:t.map((e,t)=>{let a=i===e,s=n[t]?.description;return(0,r.FD)("button",{type:"button",onClick:()=>o(e),onDblClick:()=>c(e),"aria-checked":a,role:"radio",className:`group flex w-full cursor-pointer items-start gap-3 rounded-xl border p-3.5 text-left transition-all ${a?"border-ink bg-paper shadow-sm ring-1 ring-ink/10":"border-ink/10 bg-canvas/30 hover:border-ink/25 hover:bg-paper"}`,children:[(0,r.Y)("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md font-mono text-[11px] font-semibold transition-colors ${a?"bg-ink text-paper":"border border-ink/15 bg-paper text-ink/60 group-hover:border-ink/30 group-hover:text-ink"}`,children:t+1}),(0,r.FD)("div",{className:"min-w-0 flex-1",children:[(0,r.Y)("div",{className:"flex items-center gap-2",children:(0,r.Y)("span",{className:`text-[13px] font-medium leading-snug ${a?"text-ink font-semibold":"text-ink/85"}`,children:e})}),s&&(0,r.Y)("div",{className:"mt-1 text-[11.5px] leading-relaxed text-ink/55",children:s})]}),(0,r.Y)("span",{className:"mt-0.5 shrink-0",children:a?(0,r.Y)(d.A,{size:16,className:"text-ink"}):(0,r.Y)(u.A,{size:16,className:"text-ink/20 group-hover:text-ink/40"})})]},e)})}),(0,r.FD)("div",{className:"space-y-1.5 pt-1",children:[(0,r.Y)("div",{className:"text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:"Other — type your own answer"}),(0,r.Y)("input",{ref:l,type:"text",value:a,placeholder:"Type a custom answer and press Enter...",onChange:e=>s(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),a.trim()&&c(a.trim()))},className:"w-full rounded-xl border border-ink/15 bg-paper px-4 py-3 text-[13.5px] text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:ring-2 focus:ring-ink/15"})]})]})}var b=n("DTR");function f(e){let{method:t,optionsLength:n,selectedOption:i,hasCustomAnswer:a=!1,onCancel:s,onSubmit:l}=e;return(0,r.FD)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-ink/8 bg-canvas/40 px-5 py-3.5",children:[(0,r.FD)("div",{className:"flex items-center gap-2 font-mono text-[11px] text-ink/50",children:["select"===t&&(0,r.FD)(r.FK,{children:[(0,r.FD)("span",{className:"hidden items-center gap-1 sm:inline-flex",children:[(0,r.FD)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:["1-",Math.min(9,n)]}),(0,r.Y)("span",{className:"text-ink/40",children:"choose"})]}),(0,r.Y)("span",{className:"hidden text-ink/30 sm:inline",children:"•"}),(0,r.FD)("span",{className:"inline-flex items-center gap-1",children:[(0,r.Y)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"↵"}),(0,r.Y)("span",{className:"text-ink/40",children:"select"})]})]}),"confirm"===t&&(0,r.FD)("span",{className:"inline-flex items-center gap-1",children:[(0,r.Y)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"↵"}),(0,r.Y)("span",{className:"text-ink/40",children:"confirm"})]}),"editor"===t&&(0,r.FD)("span",{className:"inline-flex items-center gap-1",children:[(0,r.Y)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"⌘↵"}),(0,r.Y)("span",{className:"text-ink/40",children:"save buffer"})]}),(0,r.Y)("span",{className:"text-ink/30",children:"•"}),(0,r.FD)("span",{className:"inline-flex items-center gap-1",children:[(0,r.Y)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"Esc"}),(0,r.Y)("span",{className:"text-ink/40",children:"cancel"})]})]}),(0,r.FD)("div",{className:"flex items-center gap-2.5 ml-auto",children:[(0,r.FD)("button",{type:"button",onClick:s,className:"flex cursor-pointer items-center gap-1 rounded-lg border border-ink/15 bg-paper px-3.5 py-1.5 text-[12px] font-medium text-ink/70 transition-colors hover:border-ink/30 hover:bg-canvas/50 hover:text-ink",children:[(0,r.Y)(m.A,{size:12,className:"opacity-60"}),(0,r.Y)("span",{children:"Cancel"})]}),(0,r.FD)("button",{type:"button",onClick:l,disabled:"select"===t&&!i&&!a,className:"flex cursor-pointer items-center gap-1.5 rounded-lg bg-ink px-4 py-1.5 text-[12px] font-semibold text-paper shadow-xs transition-all hover:opacity-90 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-35",children:[(0,r.Y)("span",{children:"confirm"===t?"Confirm":"select"===t?"Select Option":"Submit Response"}),(0,r.Y)(b.A,{size:12,className:"opacity-70"})]})]})]})}var k=n("vp");function g(e){let{request:t,onRespond:n}=e,[p,m]=(0,i.J0)("editor"===t.method?t.prefill??"":""),[u,b]=(0,i.J0)(null),[g,v]=(0,i.J0)(""),N=(0,i.li)(null),y=(0,i.li)(null),w=(0,i.li)(null),Y=(0,i.li)(null),D=t.options??[],F=t.optionDetails??[];(0,i.vJ)(()=>{m("editor"===t.method?t.prefill??"":""),b(D.length>0?D[0]:null),v("")},[t,D]),(0,i.vJ)(()=>{N.current?.focus(),"input"===t.method?y.current?.focus():"editor"===t.method?w.current?.focus():"select"===t.method&&D.some(e=>/^other\b/i.test(e.trim()))&&Y.current?.focus()},[t.id,t.method,D]);let C=(0,i.hb)(()=>{n(t,{cancelled:!0})},[n,t]),A=(0,i.hb)(()=>{"confirm"===t.method?n(t,{confirmed:!0}):"select"===t.method?g.trim()?n(t,{value:g.trim()}):u&&n(t,{value:u}):n(t,{value:p})},[n,t,u,p,g]),E=(0,i.hb)(e=>{if(/^other\b/i.test(e.trim())){b(e),Y.current?.focus();return}n(t,{value:e})},[n,t]),z=(0,i.hb)(e=>{b(e),/^other\b/i.test(e.trim())&&Y.current?.focus()},[]);(0,i.vJ)(()=>{let e=e=>{if("Escape"===e.key){e.preventDefault(),e.stopPropagation(),C();return}if("select"===t.method&&D.length>0){if(e.target instanceof HTMLInputElement&&e.target===Y.current)return;let t=parseInt(e.key,10);if(!isNaN(t)&&t>=1&&t<=D.length){e.preventDefault(),b(D[t-1]);return}if("ArrowDown"===e.key){e.preventDefault();let t=D.findIndex(e=>e===u),n=t<D.length-1?t+1:0;b(D[n]);return}if("ArrowUp"===e.key){e.preventDefault();let t=D.findIndex(e=>e===u),n=t>0?t-1:D.length-1;b(D[n]);return}if("Enter"===e.key&&u){e.preventDefault(),A();return}}if("confirm"===t.method&&"Enter"===e.key||"editor"===t.method&&(e.metaKey||e.ctrlKey)&&"Enter"===e.key){e.preventDefault(),A();return}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[C,A,t.method,D,u]);let j=(()=>{switch(t.method){case"select":return{icon:(0,r.Y)(a,{size:16,className:"text-ink"}),label:"Decision Required",badge:`${D.length} Choices`};case"confirm":return{icon:(0,r.Y)(s.A,{size:16,className:"text-ink"}),label:"Confirmation Required",badge:"Confirm Action"};case"input":return{icon:(0,r.Y)(l.A,{size:16,className:"text-ink"}),label:"Prompt Input",badge:"Text Input"};case"editor":return{icon:(0,r.Y)(o.A,{size:16,className:"text-ink"}),label:"Buffer Editor",badge:"Multiline Buffer"};default:return{icon:(0,r.Y)(c.A,{size:16,className:"text-ink"}),label:"Agent Request",badge:"Input"}}})();return(0,r.Y)("div",{className:"extension-dialog-backdrop fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6",style:{background:"color-mix(in srgb, var(--theme-ink) 55%, transparent)",backdropFilter:"blur(8px)"},onMouseDown:e=>{e.target===e.currentTarget&&C()},children:(0,r.FD)("div",{ref:N,role:"dialog","aria-modal":"true","aria-label":t.title||j.label,tabIndex:-1,className:"extension-dialog-panel w-full max-w-[560px] overflow-hidden rounded-2xl border border-ink/15 bg-paper shadow-2xl outline-none",style:{boxShadow:"0 24px 64px -8px color-mix(in srgb, var(--theme-ink) 28%, transparent)"},children:[(0,r.Y)(x,{title:t.title,methodLabel:j.label,badge:j.badge,icon:j.icon,onCancel:C}),(0,r.FD)("div",{className:"max-h-[65vh] overflow-y-auto px-6 py-5 space-y-4",children:[t.message&&(0,r.Y)("div",{className:"rounded-xl border border-ink/8 bg-canvas/40 p-4 text-[13px] leading-relaxed text-ink/85 select-text",children:(0,r.Y)(k.T,{content:t.message})}),"select"===t.method&&(0,r.Y)(h,{options:D,optionDetails:F,selectedOption:u,customValue:g,onCustomChange:v,customInputRef:Y,onSelect:z,onConfirmOption:E}),"confirm"===t.method&&(0,r.FD)("div",{className:"flex items-center gap-3 rounded-xl border border-ink/10 bg-canvas/30 p-4",children:[(0,r.Y)("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-ink/5 text-ink",children:(0,r.Y)(d.A,{size:18})}),(0,r.FD)("div",{className:"text-[12.5px] leading-relaxed text-ink/75",children:["Confirming will allow the autonomous agent to proceed with this operation. Press ",(0,r.Y)("kbd",{className:"rounded border border-ink/20 bg-paper px-1 py-0.2 font-mono text-[10.5px]",children:"Enter"})," to confirm or ",(0,r.Y)("kbd",{className:"rounded border border-ink/20 bg-paper px-1 py-0.2 font-mono text-[10.5px]",children:"Esc"})," to abort."]})]}),"input"===t.method&&(0,r.FD)("div",{className:"space-y-2",children:[(0,r.FD)("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[(0,r.Y)("span",{children:"Your Response"}),(0,r.Y)("span",{className:"font-mono text-[10px] text-ink/40",children:"Press [Enter] to submit"})]}),(0,r.Y)("input",{ref:y,type:"text",value:p,placeholder:t.placeholder||"Type your response...",onChange:e=>m(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),A())},className:"w-full rounded-xl border border-ink/15 bg-paper px-4 py-3 text-[13.5px] text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:ring-2 focus:ring-ink/15"})]}),"editor"===t.method&&(0,r.FD)("div",{className:"space-y-2",children:[(0,r.FD)("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[(0,r.Y)("span",{children:"Buffer Content"}),(0,r.FD)("span",{className:"font-mono text-[10px] text-ink/40",children:[p.split("\n").length," lines · ⌘↵ to save"]})]}),(0,r.Y)("textarea",{ref:w,value:p,onChange:e=>m(e.currentTarget.value),rows:8,placeholder:t.placeholder||"Enter content...",className:"w-full rounded-xl border border-ink/15 bg-canvas/30 px-4 py-3 font-mono text-[12px] leading-relaxed text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:bg-paper focus:ring-2 focus:ring-ink/15"})]})]}),(0,r.Y)(f,{method:t.method,optionsLength:D.length,selectedOption:u,hasCustomAnswer:g.trim().length>0,onCancel:C,onSubmit:A})]})})}}}]);
|
|
1
|
+
/*! LICENSE: xn.6510c0abe2.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["xn"],{PB(e,t,n){n.d(t,{ExtensionDialog:()=>g});var r=n("j"),i=n("H");let a=(0,n("y").A)({name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]});var s=n("p"),l=n("N"),o=n("SR"),c=n("WO"),d=n("m"),p=n("tN"),m=n("S");function x(e){let{title:t,methodLabel:n,badge:i,icon:a,onCancel:s}=e;return(0,r.FD)("div",{className:"flex items-center justify-between border-b border-ink/8 bg-canvas/40 px-5 py-3.5",children:[(0,r.FD)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,r.Y)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-ink/12 bg-paper text-ink shadow-xs",children:a}),(0,r.FD)("div",{className:"min-w-0",children:[(0,r.FD)("div",{className:"flex items-center gap-2",children:[(0,r.Y)("h3",{className:"truncate text-[14px] font-semibold tracking-tight text-ink",children:t||n}),(0,r.FD)("span",{className:"flex items-center gap-1 rounded-full border border-ink/10 bg-paper px-2 py-0.5 font-mono text-[9px] font-medium tracking-wider text-ink/60 uppercase",children:[(0,r.Y)(p.A,{size:9,className:"text-ink/40"}),i]})]}),(0,r.Y)("p",{className:"mt-0.5 text-[11px] text-ink/50",children:"Autonomous agent inquiry requiring user confirmation"})]})]}),(0,r.Y)("button",{type:"button",onClick:s,"aria-label":"Close dialog (Esc)",title:"Cancel (Esc)",className:"flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-ink/10 text-ink/45 transition-colors hover:border-ink/25 hover:bg-ink/5 hover:text-ink",children:(0,r.Y)(m.A,{size:14})})]})}var u=n("V");function h(e){let{options:t,optionDetails:n,selectedOption:i,customValue:a,onCustomChange:s,customInputRef:l,onSelect:o,onConfirmOption:c}=e;return(0,r.FD)("div",{className:"space-y-2",children:[(0,r.FD)("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[(0,r.Y)("span",{children:"Available Options"}),(0,r.FD)("span",{className:"font-mono text-[10px] text-ink/40",children:["Press [1-",Math.min(9,t.length),"] to choose"]})]}),(0,r.Y)("div",{className:"grid gap-2",role:"radiogroup",children:t.map((e,t)=>{let a=i===e,s=n[t]?.description;return(0,r.FD)("button",{type:"button",onClick:()=>o(e),onDblClick:()=>c(e),"aria-checked":a,role:"radio",className:`group flex w-full cursor-pointer items-start gap-3 rounded-xl border p-3.5 text-left transition-all ${a?"border-ink bg-paper shadow-sm ring-1 ring-ink/10":"border-ink/10 bg-canvas/30 hover:border-ink/25 hover:bg-paper"}`,children:[(0,r.Y)("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md font-mono text-[11px] font-semibold transition-colors ${a?"bg-ink text-paper":"border border-ink/15 bg-paper text-ink/60 group-hover:border-ink/30 group-hover:text-ink"}`,children:t+1}),(0,r.FD)("div",{className:"min-w-0 flex-1",children:[(0,r.Y)("div",{className:"flex items-center gap-2",children:(0,r.Y)("span",{className:`text-[13px] font-medium leading-snug ${a?"text-ink font-semibold":"text-ink/85"}`,children:e})}),s&&(0,r.Y)("div",{className:"mt-1 text-[11.5px] leading-relaxed text-ink/55",children:s})]}),(0,r.Y)("span",{className:"mt-0.5 shrink-0",children:a?(0,r.Y)(d.A,{size:16,className:"text-ink"}):(0,r.Y)(u.A,{size:16,className:"text-ink/20 group-hover:text-ink/40"})})]},e)})}),(0,r.FD)("div",{className:"space-y-1.5 pt-1",children:[(0,r.Y)("div",{className:"text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:"Other — type your own answer"}),(0,r.Y)("input",{ref:l,type:"text",value:a,placeholder:"Type a custom answer and press Enter...",onChange:e=>s(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),a.trim()&&c(a.trim()))},className:"w-full rounded-xl border border-ink/15 bg-paper px-4 py-3 text-[13.5px] text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:ring-2 focus:ring-ink/15"})]})]})}var b=n("DTR");function f(e){let{method:t,optionsLength:n,selectedOption:i,hasCustomAnswer:a=!1,onCancel:s,onSubmit:l}=e;return(0,r.FD)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-ink/8 bg-canvas/40 px-5 py-3.5",children:[(0,r.FD)("div",{className:"flex items-center gap-2 font-mono text-[11px] text-ink/50",children:["select"===t&&(0,r.FD)(r.FK,{children:[(0,r.FD)("span",{className:"hidden items-center gap-1 sm:inline-flex",children:[(0,r.FD)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:["1-",Math.min(9,n)]}),(0,r.Y)("span",{className:"text-ink/40",children:"choose"})]}),(0,r.Y)("span",{className:"hidden text-ink/30 sm:inline",children:"•"}),(0,r.FD)("span",{className:"inline-flex items-center gap-1",children:[(0,r.Y)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"↵"}),(0,r.Y)("span",{className:"text-ink/40",children:"select"})]})]}),"confirm"===t&&(0,r.FD)("span",{className:"inline-flex items-center gap-1",children:[(0,r.Y)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"↵"}),(0,r.Y)("span",{className:"text-ink/40",children:"confirm"})]}),"editor"===t&&(0,r.FD)("span",{className:"inline-flex items-center gap-1",children:[(0,r.Y)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"⌘↵"}),(0,r.Y)("span",{className:"text-ink/40",children:"save buffer"})]}),(0,r.Y)("span",{className:"text-ink/30",children:"•"}),(0,r.FD)("span",{className:"inline-flex items-center gap-1",children:[(0,r.Y)("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"Esc"}),(0,r.Y)("span",{className:"text-ink/40",children:"cancel"})]})]}),(0,r.FD)("div",{className:"flex items-center gap-2.5 ml-auto",children:[(0,r.FD)("button",{type:"button",onClick:s,className:"flex cursor-pointer items-center gap-1 rounded-lg border border-ink/15 bg-paper px-3.5 py-1.5 text-[12px] font-medium text-ink/70 transition-colors hover:border-ink/30 hover:bg-canvas/50 hover:text-ink",children:[(0,r.Y)(m.A,{size:12,className:"opacity-60"}),(0,r.Y)("span",{children:"Cancel"})]}),(0,r.FD)("button",{type:"button",onClick:l,disabled:"select"===t&&!i&&!a,className:"flex cursor-pointer items-center gap-1.5 rounded-lg bg-ink px-4 py-1.5 text-[12px] font-semibold text-paper shadow-xs transition-all hover:opacity-90 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-35",children:[(0,r.Y)("span",{children:"confirm"===t?"Confirm":"select"===t?"Select Option":"Submit Response"}),(0,r.Y)(b.A,{size:12,className:"opacity-70"})]})]})]})}var k=n("rz");function g(e){let{request:t,onRespond:n}=e,[p,m]=(0,i.J0)("editor"===t.method?t.prefill??"":""),[u,b]=(0,i.J0)(null),[g,v]=(0,i.J0)(""),N=(0,i.li)(null),y=(0,i.li)(null),w=(0,i.li)(null),Y=(0,i.li)(null),D=t.options??[],F=t.optionDetails??[];(0,i.vJ)(()=>{let e=t.options??[];m("editor"===t.method?t.prefill??"":""),b(e.length>0?e[0]:null),v("")},[t]),(0,i.vJ)(()=>{N.current?.focus(),"input"===t.method?y.current?.focus():"editor"===t.method?w.current?.focus():"select"===t.method&&(t.options??[]).some(e=>/^other\b/i.test(e.trim()))&&Y.current?.focus()},[t]);let C=(0,i.hb)(()=>{n(t,{cancelled:!0})},[n,t]),A=(0,i.hb)(()=>{"confirm"===t.method?n(t,{confirmed:!0}):"select"===t.method?g.trim()?n(t,{value:g.trim()}):u&&n(t,{value:u}):n(t,{value:p})},[n,t,u,p,g]),E=(0,i.hb)(e=>{if(/^other\b/i.test(e.trim())){b(e),Y.current?.focus();return}n(t,{value:e})},[n,t]),z=(0,i.hb)(e=>{b(e),/^other\b/i.test(e.trim())&&Y.current?.focus()},[]);(0,i.vJ)(()=>{let e=e=>{if("Escape"===e.key){e.preventDefault(),e.stopPropagation(),C();return}if("select"===t.method&&D.length>0){if(e.target instanceof HTMLInputElement&&e.target===Y.current)return;let t=parseInt(e.key,10);if(!isNaN(t)&&t>=1&&t<=D.length){e.preventDefault(),b(D[t-1]);return}if("ArrowDown"===e.key){e.preventDefault();let t=D.findIndex(e=>e===u),n=t<D.length-1?t+1:0;b(D[n]);return}if("ArrowUp"===e.key){e.preventDefault();let t=D.findIndex(e=>e===u),n=t>0?t-1:D.length-1;b(D[n]);return}if("Enter"===e.key&&u){e.preventDefault(),A();return}}if("confirm"===t.method&&"Enter"===e.key||"editor"===t.method&&(e.metaKey||e.ctrlKey)&&"Enter"===e.key){e.preventDefault(),A();return}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[C,A,t.method,D,u]);let j=(()=>{switch(t.method){case"select":return{icon:(0,r.Y)(a,{size:16,className:"text-ink"}),label:"Decision Required",badge:`${D.length} Choices`};case"confirm":return{icon:(0,r.Y)(s.A,{size:16,className:"text-ink"}),label:"Confirmation Required",badge:"Confirm Action"};case"input":return{icon:(0,r.Y)(l.A,{size:16,className:"text-ink"}),label:"Prompt Input",badge:"Text Input"};case"editor":return{icon:(0,r.Y)(o.A,{size:16,className:"text-ink"}),label:"Buffer Editor",badge:"Multiline Buffer"};default:return{icon:(0,r.Y)(c.A,{size:16,className:"text-ink"}),label:"Agent Request",badge:"Input"}}})();return(0,r.Y)("div",{className:"extension-dialog-backdrop fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6",style:{background:"color-mix(in srgb, var(--theme-ink) 55%, transparent)",backdropFilter:"blur(8px)"},onMouseDown:e=>{e.target===e.currentTarget&&C()},children:(0,r.FD)("div",{ref:N,role:"dialog","aria-modal":"true","aria-label":t.title||j.label,tabIndex:-1,className:"extension-dialog-panel w-full max-w-[560px] overflow-hidden rounded-2xl border border-ink/15 bg-paper shadow-2xl outline-none",style:{boxShadow:"0 24px 64px -8px color-mix(in srgb, var(--theme-ink) 28%, transparent)"},children:[(0,r.Y)(x,{title:t.title,methodLabel:j.label,badge:j.badge,icon:j.icon,onCancel:C}),(0,r.FD)("div",{className:"max-h-[65vh] overflow-y-auto px-6 py-5 space-y-4",children:[t.message&&(0,r.Y)("div",{className:"rounded-xl border border-ink/8 bg-canvas/40 p-4 text-[13px] leading-relaxed text-ink/85 select-text",children:(0,r.Y)(k.T,{content:t.message})}),"select"===t.method&&(0,r.Y)(h,{options:D,optionDetails:F,selectedOption:u,customValue:g,onCustomChange:v,customInputRef:Y,onSelect:z,onConfirmOption:E}),"confirm"===t.method&&(0,r.FD)("div",{className:"flex items-center gap-3 rounded-xl border border-ink/10 bg-canvas/30 p-4",children:[(0,r.Y)("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-ink/5 text-ink",children:(0,r.Y)(d.A,{size:18})}),(0,r.FD)("div",{className:"text-[12.5px] leading-relaxed text-ink/75",children:["Confirming will allow the autonomous agent to proceed with this operation. Press ",(0,r.Y)("kbd",{className:"rounded border border-ink/20 bg-paper px-1 py-0.2 font-mono text-[10.5px]",children:"Enter"})," to confirm or ",(0,r.Y)("kbd",{className:"rounded border border-ink/20 bg-paper px-1 py-0.2 font-mono text-[10.5px]",children:"Esc"})," to abort."]})]}),"input"===t.method&&(0,r.FD)("div",{className:"space-y-2",children:[(0,r.FD)("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[(0,r.Y)("span",{children:"Your Response"}),(0,r.Y)("span",{className:"font-mono text-[10px] text-ink/40",children:"Press [Enter] to submit"})]}),(0,r.Y)("input",{ref:y,type:"text",value:p,placeholder:t.placeholder||"Type your response...",onChange:e=>m(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),A())},className:"w-full rounded-xl border border-ink/15 bg-paper px-4 py-3 text-[13.5px] text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:ring-2 focus:ring-ink/15"})]}),"editor"===t.method&&(0,r.FD)("div",{className:"space-y-2",children:[(0,r.FD)("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[(0,r.Y)("span",{children:"Buffer Content"}),(0,r.FD)("span",{className:"font-mono text-[10px] text-ink/40",children:[p.split("\n").length," lines · ⌘↵ to save"]})]}),(0,r.Y)("textarea",{ref:w,value:p,onChange:e=>m(e.currentTarget.value),rows:8,placeholder:t.placeholder||"Enter content...",className:"w-full rounded-xl border border-ink/15 bg-canvas/30 px-4 py-3 font-mono text-[12px] leading-relaxed text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:bg-paper focus:ring-2 focus:ring-ink/15"})]})]}),(0,r.Y)(f,{method:t.method,optionsLength:D.length,selectedOption:u,hasCustomAnswer:g.trim().length>0,onCancel:C,onSubmit:A})]})})}}}]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! LICENSE:
|
|
2
|
-
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["
|
|
1
|
+
/*! LICENSE: xn1.83a7784fe1.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["xn1"],{uf(e,t,n){n.d(t,{P:()=>Y});var r=n("j"),i=n("H");let l=/[^a-z0-9]([a-z0-9]+)$/i;function a(e,t){e.stack.length&&e.offset>-1&&(e.stack=e.stack.slice(0,e.offset+1)),e.stack.push(t),e.offset=e.stack.length-1}function o(e,t){return e.substring(0,t).split("\n").pop()?.match(l)?.[1]}function s(e,t){let n="undo"===t?e.offset-1:e.offset+1,r=e.stack[n];return r?(e.offset="undo"===t?Math.max(n,0):Math.min(n,e.stack.length-1),r):null}let c=`
|
|
3
3
|
.code-editor-native-textarea {
|
|
4
4
|
-webkit-text-fill-color: transparent;
|
|
5
5
|
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
-webkit-text-fill-color: var(--theme-ink);
|
|
8
8
|
opacity: 0.45;
|
|
9
9
|
}
|
|
10
|
-
`;function d(){return(0,r.Y)("style",{dangerouslySetInnerHTML:{__html:c}})}function u(e,t){return e.substring(0,t).split("\n")}function h(e){let{value:t,onValueChange:n,highlight:l,padding:c=0,preClassName:h,textareaClassName:f,style:p,preRef:m,className:x,placeholder:b,readOnly:g,autoFocus:y,virtual:v}=e,k=(0,i.li)(null),w=(0,i.li)({stack:[],offset:-1}),[N,Y]=(0,i.J0)(!0);(0,i.vJ)(()=>{let e=k.current;e&&a(w.current,{value:e.value,selectionStart:e.selectionStart,selectionEnd:e.selectionEnd,timestamp:Date.now()})},[t]);let D=e=>{let t=k.current,r=w.current.stack[w.current.offset];r&&t&&(w.current.stack[w.current.offset]={...r,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}),function(e,t){if(a(e,t),e.stack.length<=100)return;let n=e.stack.length-100;e.stack=e.stack.slice(n),e.offset=Math.max(e.offset-n,0)}(w.current,{...e,timestamp:Date.now()}),n(e.value),t&&(t.value=e.value,t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd)},F={margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"},C={paddingTop:c,paddingRight:c,paddingBottom:c,paddingLeft:c},S={...C,paddingTop:c+(v?.top??0),paddingBottom:c+(v?.bottom??0)},M=l(t,v??null);return(0,r.FD)("div",{className:x,style:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden",...p},children:[(0,r.Y)("pre",{ref:m,className:h,"aria-hidden":"true",style:{...F,...S,position:"relative",pointerEvents:"none"},dangerouslySetInnerHTML:{__html:M+(v&&!v.breakAtEnd?"":"<br />")}}),(0,r.Y)("textarea",{ref:k,className:`code-editor-native-textarea${f?` ${f}`:""}`,style:{...F,...C,position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",WebkitTextFillColor:"transparent"},value:t,onChange:e=>{let{value:t,selectionStart:r,selectionEnd:i}=e.target,l=w.current,s=Date.now();if(function(e,t,n,r){if(!e||r-e.timestamp>=3e3)return!1;let i=o(e.value,e.selectionStart),l=o(t,n);return!!(i&&l?.startsWith(i))}(l.stack[l.offset],t,r,s)){l.stack=l.stack.slice(0,l.offset+1),l.stack[l.offset]={value:t,selectionStart:r,selectionEnd:i,timestamp:s},n(t);return}a(l,{value:t,selectionStart:r,selectionEnd:i,timestamp:s}),n(t)},onKeyDown:e=>{if("Escape"===e.key)return void e.currentTarget.blur();let{value:t,selectionStart:r,selectionEnd:i}=e.currentTarget,l=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),a=/Win/i.test(navigator.platform);if("Tab"===e.key&&N){if(e.preventDefault(),e.shiftKey){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=t.split("\n").map((e,t)=>t>=n&&t<=l&&e.startsWith(" ")?e.substring(2):e).join("\n");if(a!==t){let l=e[n];D({value:a,selectionStart:l?.startsWith(" ")?r-2:r,selectionEnd:i-(t.length-a.length)})}}else if(r!==i){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=e[n];D({value:t.split("\n").map((e,t)=>t>=n&&t<=l?" "+e:e).join("\n"),selectionStart:a&&/\S/.test(a)?r+2:r,selectionEnd:i+2*(l-n+1)})}else{let e=r+2;D({value:t.substring(0,r)+" "+t.substring(i),selectionStart:e,selectionEnd:e})}return}if("Backspace"===e.key&&r===i){if(t.substring(0,r).endsWith(" ")){e.preventDefault();let n=r-2;D({value:t.substring(0,r-2)+t.substring(i),selectionStart:n,selectionEnd:n})}return}if("Enter"===e.key&&r===i){let n=u(t,r).pop(),l=n?.match(/^\s+/);if(l?.[0]){e.preventDefault();let n="\n"+l[0],a=r+n.length;D({value:t.substring(0,r)+n+t.substring(i),selectionStart:a,selectionEnd:a})}return}if((l?e.metaKey&&"z"===e.key.toLowerCase():e.ctrlKey&&"z"===e.key.toLowerCase())&&!e.shiftKey&&!e.altKey){e.preventDefault();let t=s(w.current,"undo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}if((l?e.metaKey&&e.shiftKey&&"z"===e.key.toLowerCase():a?e.ctrlKey&&"y"===e.key.toLowerCase():e.ctrlKey&&e.shiftKey&&"z"===e.key.toLowerCase())&&!e.altKey){e.preventDefault();let t=s(w.current,"redo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}e.ctrlKey&&"m"===e.key.toLowerCase()&&(!l||e.shiftKey)&&(e.preventDefault(),Y(e=>!e))},placeholder:b,readOnly:g,autoFocus:y,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellcheck:!1,"data-gramm":!1}),(0,r.Y)(d,{})]})}let f=["direction","fontFamily","fontFeatureSettings","fontKerning","fontSize","fontStyle","fontVariantLigatures","fontWeight","letterSpacing","overflowWrap","tabSize","textRendering","textTransform","whiteSpace","wordBreak","wordSpacing"],p=null,m=[],x="",b=new Map,g=[];function y(e){if("u"<typeof document||!e.isConnected)return null;let t=Number.parseFloat(getComputedStyle(e).lineHeight);return Number.isFinite(t)&&t>0?t:null}function v(e,t,n){return e<t?t:e>n?n:e}function k(e){return{start:0,end:v(200,1,Math.max(e,1))}}var w=n("Po"),N=n("DU");function Y(e){var t;let{value:n,onValueChange:l,language:a,wordWrap:o,rootClassName:s,gutterClassName:c,gutterStyle:d,gutterLineClassName:u,editorWrapperClassName:Y,editorClassName:D,editorPadding:F=0,editorStyle:C}=e,S=o?"!whitespace-pre-wrap !break-words":"!whitespace-pre !break-normal",M=(0,i.li)(null),z=(0,i.li)(null),[T,E]=(0,i.J0)(null),[A,L]=(0,i.J0)(null),[$,j]=(0,i.J0)(-1);(0,w.w)();let J=(0,i.Kr)(()=>(function(e){let t=1;for(let n=e.indexOf("\n");-1!==n;n=e.indexOf("\n",n+1))t++;return t})(n),[n]),W=(0,i.hb)(()=>{let e=M.current;if(!e)return;let t=o?function(e,t){let n=y(e);if(null===n)return null;let r=getComputedStyle(e),i=e.clientWidth-Number.parseFloat(r.paddingLeft||"0")-Number.parseFloat(r.paddingRight||"0");if(i<=0)return null;let l=(p&&p.isConnected||((p=document.createElement("div")).setAttribute("aria-hidden","true"),p.style.cssText="position:fixed;top:0;left:-100000px;visibility:hidden;pointer-events:none;margin:0;border:0;padding:0;box-sizing:border-box;",document.body.appendChild(p),m=[]),p);for(let e of f)l.style[e]=r[e];l.style.lineHeight=`${n}px`,l.style.width=`${i}px`;let a=`${i}|${n}|${f.map(e=>r[e]).join("|")}`;a!==x&&(x=a,b.clear());let o=t.split("\n"),s=Array(o.length),c=0;for(let e=0;e<o.length;e++){let t=b.get(o[e]);void 0===t?g[c++]=e:s[e]=t}if(c>0){for(;m.length<c;){let e=document.createElement("div");l.appendChild(e),m.push(e)}for(let e=0;e<c;e++)m[e].textContent=o[g[e]];for(let e=0;e<c;e++){let t=g[e],r=m[e].getBoundingClientRect().height,i=r>n?Math.round(r/n)*n:n;s[t]=i,b.set(o[t],i)}if(b.size>1e5){let e=b.size-5e4;for(let t of b.keys()){if(e--<=0)break;b.delete(t)}}}return{rowHeight:n,heights:s}}(e,n):null;E(e=>e===t||e&&t&&e.rowHeight===t.rowHeight&&e.heights.length===t.heights.length&&e.heights.every((e,n)=>e===t.heights[n])?e:t);let r=t?.rowHeight??y(e);L(e=>e===r?e:r),j(J)},[n,J,o,F,C?.fontSize]);(0,i.Nf)(()=>{W()},[W]);let H=(0,i.li)(W);H.current=W,(0,i.vJ)(()=>{let e=M.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>H.current());return t.observe(e),()=>t.disconnect()},[]);let O=(0,i.Kr)(()=>null===A?null:T?function(e,t,n){if(0===n||e.length!==n)return null;let r=new Float64Array(n+1);for(let t=0;t<n;t++)r[t+1]=r[t]+e[t];let i=r[n];return{lineCount:n,rowHeight:t,totalHeight:i,offsetOf:e=>r[v(e,0,n)],lineAt:e=>{if(e<0)return 0;if(i<=0||e>=i)return n-1;let t=0,l=n-1;for(;t<l;){let n=t+l+1>>1;r[n]<=e?t=n:l=n-1}return t}}}(T.heights,T.rowHeight,J):{lineCount:J,rowHeight:A,totalHeight:A*J,offsetOf:e=>A*v(e,0,J),lineAt:e=>v(Math.floor(e/A),0,Math.max(J-1,0))},[A,T,J]),R=(t=n.length,J>300||t>2e4),K=function(e){var t,n;let r,l,{rootRef:a,lineCount:o,geometry:s,enabled:c}=e,[d,u]=(0,i.J0)(null),h=(0,i.hb)(()=>{let e,t,n,r,i=a.current;if(!c||!i)return;let l=s?(e=i.getBoundingClientRect().top,n=(t=function(e){for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e||"overlay"===e)&&t.scrollHeight>t.clientHeight)return t}return null}(i))?t.getBoundingClientRect().top:0,r=t?t.getBoundingClientRect().bottom:globalThis.innerHeight||s.rowHeight,function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:24,i=e.lineAt(t),l=e.lineAt(t+Math.max(n,0));return{start:Math.max(0,i-r),end:Math.min(e.lineCount,Math.max(l+1,i+1)+r)}}(s,n-e,r-n)):k(o);u(e=>e===l||null!==e&&null!==l&&e.start===l.start&&e.end===l.end?e:l)},[c,s,o,a]);(0,i.Nf)(()=>{h()},[h]);let f=(0,i.li)(h);if(f.current=h,(0,i.vJ)(()=>{if(!c)return;let e=0,t=()=>{e||(e=requestAnimationFrame(()=>{e=0,f.current()}))};window.addEventListener("scroll",t,{passive:!0,capture:!0}),window.addEventListener("resize",t);let n="u"<typeof ResizeObserver?null:new ResizeObserver(t),r=a.current;return r&&n?.observe(r),()=>{e&&cancelAnimationFrame(e),window.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t),n?.disconnect()}},[c,a]),!c)return null;if(!s){let e=k(o);return{...e,top:0,bottom:0,breakAtEnd:e.end>=o}}return t=d??k(s.lineCount),n=s.lineCount,{...l={start:r=v(t.start,0,Math.max(n-1,0)),end:v(t.end,r+1,Math.max(n,1))},...{top:s.offsetOf(l.start),bottom:Math.max(0,s.totalHeight-s.offsetOf(l.end)),breakAtEnd:l.end>=s.lineCount}}}({rootRef:z,lineCount:J,geometry:O,enabled:R&&($!==J||null!==O)}),I=(0,i.hb)((e,t)=>t?function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{contextLines:i=40,maxLineLength:l=12e3}=r,a=e.split("\n"),o=Math.min(Math.max(n.start,0),a.length),s=Math.min(Math.max(n.end,o),a.length);if(o===s)return"";let c=Math.max(0,o-i),d=(0,N.O9)(a.slice(c,s).join("\n"),t,{maxLineLength:l}),u=o-c;return`<span class="shiki">${d.slice(u,u+(s-o)).join("\n")}</span>`}(e,a,t):(0,N.wY)(e,a),[a]),P=K?K.start:0,U=K?Math.min(K.end,J):J,B=[];for(let e=P;e<U;e++)B.push(e);let _=T&&T.heights.length===J?T.heights:null;return(0,r.FD)("div",{className:s,ref:z,children:[(0,r.FD)("div",{className:c,style:d,children:[K&&K.top>0?(0,r.Y)("div",{style:{height:K.top,flexShrink:0},"aria-hidden":"true"}):null,B.map(e=>(0,r.Y)("div",{className:u,style:_?{height:_[e],flexShrink:0}:void 0,children:e+1},e+1))]}),(0,r.Y)("div",{className:Y,children:(0,r.Y)(h,{value:n,onValueChange:l,highlight:I,padding:F,preRef:M,textareaClassName:`focus:outline-none ${S}`,preClassName:S,style:C,className:D,virtual:K})})]})}},hR(e,t,n){var r=n("j"),i=n("H"),l=n("E6"),a=n("t");function o(e){let{src:t,name:n,className:o=""}=e,s=(0,i.li)(null),c=(0,i.li)(null),d=(0,i.li)(null),[u,h]=(0,i.J0)(null),[f,p]=(0,i.J0)(1),[m,x]=(0,i.J0)({x:0,y:0}),[b,g]=(0,i.J0)(!1),[y,v]=(0,i.J0)(null),k=(0,i.hb)(()=>{let e=c.current;return!!e&&!!e.complete&&0!==e.naturalWidth&&(h({width:e.naturalWidth,height:e.naturalHeight}),!0)},[]);(0,i.vJ)(()=>{k()},[k]);let w=(0,i.hb)(()=>{let e=c.current,t=s.current?.getBoundingClientRect(),n=e?.naturalWidth??0,r=e?.naturalHeight??0;t&&n&&r&&(p(Math.min(1,Math.max(.1,(t.width-48)/n,(t.height-48)/r))),x({x:0,y:0}))},[]);(0,i.vJ)(()=>{u&&w()},[u,w]);let N=(0,i.hb)(e=>{p(t=>Math.min(16,Math.max(.1,t*e)))},[]),Y=(0,i.hb)(e=>{e.preventDefault(),N(Math.exp(-(.0015*e.deltaY)))},[N]),D=(0,i.hb)(e=>{0===e.button&&u&&(d.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY},e.currentTarget.setPointerCapture(e.pointerId),g(!0))},[u]),F=(0,i.hb)(e=>{let t=d.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.x,r=e.clientY-t.y;t.x=e.clientX,t.y=e.clientY,x(e=>({x:e.x+n,y:e.y+r}))},[]),C=(0,i.hb)(e=>{d.current?.pointerId===e.pointerId&&(d.current=null,g(!1))},[]),S=(0,i.hb)(()=>{.01>Math.abs(f-1)?w():(p(1),x({x:0,y:0}))},[f,w]);(0,i.vJ)(()=>{let e=e=>{if("+"!==e.key&&"="!==e.key&&"-"!==e.key&&"_"!==e.key&&"0"!==e.key)return;let t=e.target;t&&s.current?.contains(t)&&(e.preventDefault(),"0"===e.key?w():"+"===e.key||"="===e.key?N(1.4):N(1/1.4))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[N,w]);let M=Math.round(100*f),z=u?`${u.width} \xd7 ${u.height} px`:"";return(0,r.FD)("div",{className:`relative flex h-full w-full flex-col bg-paper ${o}`,children:[(0,r.Y)("div",{ref:s,tabIndex:-1,onWheel:Y,onPointerDown:D,onPointerMove:F,onPointerUp:C,onPointerCancel:C,onDblClick:S,className:`image-stage relative flex-1 overflow-hidden outline-none ${b?"cursor-grabbing":"cursor-grab"}`,children:y?(0,r.FD)("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-6 text-center",children:[(0,r.Y)(l.A,{size:20,className:"text-error"}),(0,r.FD)("span",{className:"font-sans text-xs text-error",children:["Could not read ",n]}),(0,r.Y)("span",{className:"break-all font-mono text-[11px] text-ink/50",children:y})]}):(0,r.FD)(r.FK,{children:[!u&&(0,r.FD)("div",{className:"absolute inset-0 flex items-center justify-center gap-2 text-xs text-ink/40",children:[(0,r.Y)(a.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading image…"})]}),(0,r.Y)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,r.Y)("img",{ref:c,src:t,alt:n,draggable:!1,onLoad:k,onError:()=>v("The file could not be decoded as an image."),className:"image-canvas max-h-none max-w-none select-none",style:{transform:`translate3d(${m.x}px, ${m.y}px, 0) scale(${f})`,visibility:u?"visible":"hidden"}})})]})}),(0,r.FD)("div",{className:"flex flex-shrink-0 items-center justify-between border-t border-ink/10 bg-canvas px-3 py-1.5 font-mono text-[10px] text-ink/50",children:[(0,r.Y)("span",{children:z}),(0,r.FD)("div",{className:"flex items-center gap-3",children:[(0,r.Y)("button",{type:"button",onClick:()=>N(1/1.4),className:"hover:text-ink",title:"Zoom out (-)",children:"−"}),(0,r.FD)("span",{className:"w-10 text-center tabular-nums",children:[M,"%"]}),(0,r.Y)("button",{type:"button",onClick:()=>N(1.4),className:"hover:text-ink",title:"Zoom in (+)",children:"+"}),(0,r.Y)("button",{type:"button",onClick:w,className:"hover:text-ink",title:"Fit to view (0)",children:"Fit"})]})]})]})}function s(e){return(0,r.Y)(o,{...e},e.src)}n.d(t,{a:()=>s})},Xg(e,t,n){n.d(t,{M:()=>F});var r=n("j"),i=n("H"),l=n("X"),a=n("FL"),o=n("DU"),s=n("lP"),c=n("y");let d=(0,c.A)({name:"text-align-justify",size:24,node:[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],aliases:["align-justify"]}),u=(0,c.A)({name:"space",size:24,node:[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]});var h=n("n"),f=n("z"),p=n("b0"),m=n("I"),x=n("DV"),b=n("r"),g=n("AB"),y=n("pX"),v=n("LQ");function k(e){let{filePath:t,status:n,isStaged:i,viewMode:l,ignoreWhitespace:a,additions:o,deletions:c,isLoading:k,isCopied:w,onToggleViewMode:N,onToggleWhitespace:Y,onStageUnstage:D,onDiscard:F,onOpenInEditor:C,onRefresh:S,onCopyDiff:M}=e,z=t.split("/").pop()||t,T=(0,v.R)(n,i);return(0,r.FD)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-paper border-b border-ink/10 text-xs font-sans select-none flex-shrink-0 overflow-x-auto no-scrollbar",children:[(0,r.FD)("div",{className:"hidden md:flex items-center space-x-2 min-w-0 pr-2",children:[(0,r.Y)(y.o,{name:z,size:14,className:"flex-shrink-0"}),(0,r.Y)("span",{className:"font-mono text-ink font-medium truncate",title:t,children:z}),(0,r.FD)("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border ${T.badgeBgClass} flex-shrink-0`,children:[T.charStatus," ",T.label]}),(o>0||c>0)&&(0,r.FD)("div",{className:"flex items-center space-x-1.5 text-[11px] font-mono flex-shrink-0 ml-1",children:[o>0&&(0,r.FD)("span",{className:"text-success font-semibold",children:["+",o]}),c>0&&(0,r.FD)("span",{className:"text-error font-semibold",children:["-",c]})]})]}),(0,r.FD)("div",{className:"flex items-center space-x-1 text-ink/70 flex-shrink-0 ml-auto",children:[(0,r.FD)("div",{className:"flex items-center bg-canvas rounded border border-ink/15 p-0.5 mr-1",children:[(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"split"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Split (side-by-side) Diff",children:[(0,r.Y)(s.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Split"})]}),(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"unified"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Unified Diff",children:[(0,r.Y)(d,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Unified"})]})]}),(0,r.Y)("button",{type:"button",onClick:Y,className:`p-1.5 rounded transition-colors ${a?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:a?"Whitespace ignored":"Ignore whitespace",children:(0,r.Y)(u,{size:13})}),(0,r.Y)("button",{type:"button",onClick:S,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Refresh Diff",disabled:k,children:(0,r.Y)(h.A,{size:13,className:k?"animate-spin":""})}),(0,r.Y)("button",{type:"button",onClick:M,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Copy Diff Text",children:w?(0,r.Y)(f.A,{size:13,className:"text-success"}):(0,r.Y)(p.A,{size:13})}),!i&&(0,r.Y)("button",{type:"button",onClick:F,className:"p-1.5 text-ink/50 hover:text-error hover:bg-error/10 rounded transition-colors",title:"Discard changes in this file",children:(0,r.Y)(m.A,{size:13})}),(0,r.Y)("button",{type:"button",onClick:D,className:"px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink",title:i?"Unstage file":"Stage file",children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)(x.A,{size:12}),(0,r.Y)("span",{children:"Unstage"})]}):(0,r.FD)(r.FK,{children:[(0,r.Y)(b.A,{size:12}),(0,r.Y)("span",{children:"Stage"})]})}),C&&(0,r.FD)("button",{type:"button",onClick:C,className:"px-2 py-1 text-[11px] font-medium rounded bg-ink text-canvas hover:bg-ink/90 flex items-center space-x-1 transition-colors shadow-xs ml-1",title:"Open in Code Editor",children:[(0,r.Y)(g.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Edit File"})]})]})]})}var w=n("Po");function N(e){let{lines:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=-1,i=i=>{if(r<0)return;let l=(0,o.O9)(t.slice(r,i).map(e=>e.text).join("\n"),n);for(let t=r;t<i;t++)e[t]=l[t-r]??"";r=-1};return t.forEach((e,t)=>{"meta"===e.type?i(t):r<0&&(r=t)}),i(t.length),e},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.Y)("table",{className:"w-max min-w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if("meta"===e.type)return(0,r.FD)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:[(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"py-1 px-3 text-[11px] font-semibold text-meta font-mono tracking-tight",children:e.text})]},t);let n="add"===e.type,i="del"===e.type;return(0,r.FD)("tr",{className:`transition-colors group ${n?"bg-success/10 hover:bg-success/15":i?"bg-error/10 hover:bg-error/15":"hover:bg-ink/[0.03]"}`,children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${i?"bg-error/15 text-error font-semibold":n?"bg-success/15 text-success/70":"bg-canvas/50 text-ink/40"}`,children:e.oldLineNumber||""}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${n?"bg-success/15 text-success font-semibold":i?"bg-error/15 text-error/70":"bg-canvas/50 text-ink/40"}`,children:e.newLineNumber||""}),(0,r.FD)("td",{className:"py-0.5 px-3 whitespace-pre text-ink pr-6",children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${n?"text-success":i?"text-error":"opacity-0"}`,children:n?"+":i?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:e.text&&a[t]||" "}})]})]},t)})})})})}function Y(e){let{rows:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=Array(t.length).fill(""),i=-1,l=l=>{if(i<0)return;let a=t.slice(i,l),s=(0,o.O9)(a.map(e=>e.left?.text??"").join("\n"),n),c=(0,o.O9)(a.map(e=>e.right?.text??"").join("\n"),n);for(let t=i;t<l;t++)e[t]=s[t-i]??"",r[t]=c[t-i]??"";i=-1};return t.forEach((e,t)=>{e.isMeta?l(t):i<0&&(i=t)}),l(t.length),{left:e,right:r}},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.FD)("div",{className:"w-max min-w-full min-w-[700px]",children:[(0,r.FD)("div",{className:"grid grid-cols-2 sticky top-0 z-10 bg-canvas border-b border-ink/10 text-[11px] text-ink/70 font-sans select-none shadow-xs",children:[(0,r.Y)("div",{className:"px-3 py-1 font-medium border-r border-ink/10 flex items-center justify-between",children:(0,r.Y)("span",{children:"Original (HEAD / Base)"})}),(0,r.Y)("div",{className:"px-3 py-1 font-medium flex items-center justify-between",children:(0,r.Y)("span",{children:"Modified (Working Tree)"})})]}),(0,r.Y)("table",{className:"w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if(e.isMeta)return(0,r.Y)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:(0,r.Y)("td",{colSpan:4,className:"py-1 px-3 text-[11px] font-semibold text-meta text-center font-mono",children:e.metaText})},t);let n=e.left,i=e.right,l=n?.type==="del",o=i?.type==="add";return(0,r.FD)("tr",{className:"border-b border-ink/[0.04]",children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${l?"bg-error/15 text-error font-semibold":n?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:n?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre border-r border-ink/10 text-ink ${l?"bg-error/10":n?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:n?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${l?"text-error":"opacity-0"}`,children:l?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:n.text&&a.left[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${o?"bg-success/15 text-success font-semibold":i?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:i?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre text-ink ${o?"bg-success/10":i?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${o?"text-success":"opacity-0"}`,children:o?"+":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:i.text&&a.right[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})})]},t)})})})]})})}var D=n("p");function F(e){let{filePath:t,status:n="M",isStaged:s=!1,root:c,repo:d=".",onOpenInEditor:u,onFileSaved:f,className:p=""}=e,[m,x]=(0,a.LO)("diff.viewMode","unified"),[b,g]=(0,a.LO)("diff.ignoreWhitespace",!1),[y,v]=(0,i.J0)(""),[w,F]=(0,i.J0)(n),[C,S]=(0,i.J0)(s),[M,z]=(0,i.J0)(!0),[T,E]=(0,i.J0)(null),[A,L]=(0,i.J0)(!1),[$,j]=(0,i.J0)(!1),J=(0,l.L)(),W=(0,i.hb)(async()=>{if(t){z(!0),E(null);try{let e=new URLSearchParams({fileDiff:"1",file:t,staged:C?"1":"0",repo:d||"."});(n||w)&&e.set("status",n||w),c&&e.set("root",c);let r=await fetch(`/api/fs/git?${e.toString()}`),i=await r.json();i.success?(v(i.diff||""),i.status&&F(i.status)):E(i.error||"Failed to load file diff")}catch(e){E(e.message||"Error fetching diff")}finally{z(!1)}}},[t,C,d,c]);(0,i.vJ)(()=>{F(n),S(s)},[n,s,t]),(0,i.vJ)(()=>{W()},[W]);let H=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=[],i=0,l=0;if(!e||!e.trim())return{lines:n,splitRows:r,additions:i,deletions:l};let a=e.split(/\r?\n/),o=a.some(e=>e.startsWith("@@"))?a:[`@@ -1,${a.length} +1,${a.length} @@`,...a],s=1,c=1,d=[],u=[],h=()=>{let e=Math.max(d.length,u.length);for(let t=0;t<e;t++)r.push({left:d[t]?{type:"del",text:d[t].text,lineNumber:d[t].lineNumber}:void 0,right:u[t]?{type:"add",text:u[t].text,lineNumber:u[t].lineNumber}:void 0});d=[],u=[]};for(let e of o)if(!(e.startsWith("diff --git")||e.startsWith("index ")||e.startsWith("---")||e.startsWith("+++")||e.startsWith("new file mode")||e.startsWith("deleted file mode")||e.startsWith("similarity index")||e.startsWith("old mode")||e.startsWith("new mode")||e.startsWith("\\ No newline"))){if(e.startsWith("@@")){h();let t=e.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);t&&(s=parseInt(t[1],10),c=parseInt(t[2],10)),n.push({type:"meta",text:e}),r.push({isMeta:!0,metaText:e});continue}if(e.startsWith("+")){let r=e.slice(1),l=t?r.trim():r;i++,n.push({type:"add",text:l,newLineNumber:c}),u.push({text:l,lineNumber:c}),c++}else if(e.startsWith("-")){let r=e.slice(1),i=t?r.trim():r;l++,n.push({type:"del",text:i,oldLineNumber:s}),d.push({text:i,lineNumber:s}),s++}else{h();let i=e.startsWith(" ")?e.slice(1):e,l=t?i.trim():i;n.push({type:"context",text:l,oldLineNumber:s,newLineNumber:c}),r.push({left:{type:"context",text:l,lineNumber:s},right:{type:"context",text:l,lineNumber:c}}),s++,c++}}return h(),{lines:n,splitRows:r,additions:i,deletions:l}}(y,b),O=(0,o.sQ)(t);return(0,r.FD)("div",{className:`flex flex-col h-full bg-paper select-text relative font-sans ${p}`,children:[(0,r.Y)(k,{filePath:t,status:w,isStaged:C,viewMode:m,ignoreWhitespace:b,additions:H.additions,deletions:H.deletions,isLoading:M,isCopied:A,onToggleViewMode:()=>{x("unified"===m?"split":"unified")},onToggleWhitespace:()=>{g(!b)},onStageUnstage:()=>{let e=C?"unstage":"stage",n=new FormData;n.set("actionType",e),n.set("file",t),n.set("repo",d||"."),c&&n.set("root",c),J.submit(n,{method:"POST",action:"/api/fs/git"}),S(!C),setTimeout(()=>{W(),f?.()},300)},onDiscard:()=>{j(!0)},onOpenInEditor:u,onRefresh:W,onCopyDiff:()=>{y&&(navigator.clipboard.writeText(y),L(!0),setTimeout(()=>L(!1),2e3))}}),(0,r.Y)("div",{className:"flex-1 overflow-hidden relative flex flex-col bg-paper",children:M?(0,r.FD)("div",{className:"flex-1 flex items-center justify-center space-x-2 text-ink/50 text-xs font-mono",children:[(0,r.Y)(h.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading file diff..."})]}):T?(0,r.FD)("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center space-y-2",children:[(0,r.Y)(D.A,{size:20,className:"text-error"}),(0,r.Y)("p",{className:"text-xs text-error font-medium",children:T}),(0,r.Y)("button",{onClick:W,className:"px-3 py-1 text-xs bg-ink/10 hover:bg-ink/15 text-ink rounded font-sans transition-colors",children:"Retry"})]}):"split"===m?(0,r.Y)(Y,{rows:H.splitRows,language:O}):(0,r.Y)(N,{lines:H.lines,language:O})}),$&&(0,r.Y)("div",{className:"fixed inset-0 bg-ink/20 z-50 flex items-center justify-center p-4 backdrop-blur-xs",children:(0,r.FD)("div",{className:"bg-paper rounded-lg shadow-xl p-4 w-full max-w-sm border border-ink/15",children:[(0,r.Y)("h3",{className:"font-semibold text-ink mb-1.5 text-sm",children:"Discard Changes?"}),(0,r.FD)("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to discard all unstaged changes in ",(0,r.Y)("span",{className:"font-mono font-medium text-ink",children:t}),"? This cannot be undone."]}),(0,r.FD)("div",{className:"flex justify-end space-x-2",children:[(0,r.Y)("button",{type:"button",onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",children:"Cancel"}),(0,r.Y)("button",{type:"button",onClick:()=>{j(!1);let e=new FormData;e.set("actionType","discard"),e.set("file",t),e.set("repo",d||"."),c&&e.set("root",c),J.submit(e,{method:"POST",action:"/api/fs/git"}),setTimeout(()=>{W(),f?.()},300)},className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 font-medium transition-colors",children:"Discard Changes"})]})]})})]})}},FW(e,t,n){n.d(t,{n:()=>u});var r=n("H"),i=n("DU"),l=n("JK"),a=n("tZ");function o(e,t){let n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}async function s(e,t){let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);o(await n.blob(),t)}async function c(e){let t=await fetch(e);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.blob();if("u"<typeof ClipboardItem||!navigator.clipboard?.write)throw Error("Image clipboard unavailable");await navigator.clipboard.write([new ClipboardItem({[n.type]:n})])}function d(e){return String(e.id??e.path??e.name)}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{fallback:n,reportLoadError:u=!1,flushOnUnmount:h=!1,reportSaveError:f=!1,downloadMimeType:p="text/plain",onFileSaved:m}=t,[x,b]=(0,r.J0)({}),[g,y]=(0,r.J0)({}),[v,k]=(0,r.J0)(!1),[w,N]=(0,r.J0)(null),[Y,D]=(0,r.J0)("idle"),[F,C]=(0,r.J0)(0),S=e?d(e):"",M=e?x[S]??e.content??"":"",z=M!==(g[S]??M),T=e?.path&&void 0===e.content&&(0,l.CC)(e.path)?e.path:null,E=null!==T,A=T?`${(0,a.l)({...e,path:T})}&v=${F}`:null,L=(0,r.li)(new Set),$=(0,r.li)(null),j=(0,r.li)(x);j.current=x;let J=(0,r.li)(g);J.current=g;let W=(0,r.hb)((e,t)=>{b(n=>({...n,[e]:t})),y(n=>({...n,[e]:t}))},[]),H=(0,r.hb)(async(e,t)=>{if(!e.path)return;D("saving");let n=new FormData;n.append("actionType","save"),n.append("path",e.path),n.append("content",t),e.root&&n.append("root",e.root),e.repo&&"."!==e.repo&&n.append("repo",e.repo);try{let r=await fetch("/api/fs/action",{method:"POST",body:n}),i=await r.json().catch(()=>null);r.ok&&i?.success?(D("saved"),y(n=>({...n,[d(e)]:t})),m?.()):D(f?"error":"idle")}catch{D(f?"error":"idle")}},[m,f]),O=(0,r.li)(H);O.current=H,(0,r.vJ)(()=>{if(!e)return;let t=d(e);if(L.current.has(t))return;if(L.current.add(t),E){N(null),k(!1);return}if(void 0!==e.content){W(t,e.content),N(null);return}if(!e.path)return u?void N("No file path supplied for this attachment."):void W(t,n?n(e.name):"");let r=void 0===j.current[t],i=!1;r&&k(!0),N(null);let l=new URLSearchParams({path:e.path});return e.root&&l.set("root",e.root),e.repo&&"."!==e.repo&&l.set("repo",e.repo),fetch(`/api/fs/read?${l.toString()}`).then(async e=>{let t=await e.json().catch(()=>null);if(u){if(!e.ok||!t||"string"!=typeof t.content)throw Error(t?.error||`HTTP ${e.status}`);return t.content}return"string"==typeof t?.content?t.content:null}).then(r=>{if(i)return;let l=j.current[t];if(void 0!==l&&l!==J.current[t])return;let a=$.current;a&&d(a.file)===t||W(t,r??(n?n(e.name):""))}).catch(l=>{i||r&&(u?(W(t,""),N(l instanceof Error?l.message:"Failed to read file")):W(t,n?n(e.name):""))}).finally(()=>{i||k(!1)}),()=>{i=!0}},[S,e,n,u,W,F,E]),(0,r.vJ)(()=>{if("saved"!==Y)return;let e=window.setTimeout(()=>D("idle"),1500);return()=>window.clearTimeout(e)},[Y]);let R=(0,r.hb)(t=>{if(!e||E)return;let n=d(e);if(b(e=>({...e,[n]:t})),!e.path)return;$.current&&window.clearTimeout($.current.timer);let r=window.setTimeout(()=>{$.current=null,O.current(e,t)},800);$.current={timer:r,file:e,content:t}},[e,E]),K=(0,r.hb)(()=>{if(!e||E)return;let t=x[d(e)];void 0!==t&&($.current&&(window.clearTimeout($.current.timer),$.current=null),O.current(e,t))},[e,x,E]),{copied:I,copy:P,download:U}=function(e){let{target:t,content:n,imageUrl:i,downloadMimeType:l}=e,[a,d]=(0,r.J0)(!1),u=(0,r.hb)(()=>{d(!0),window.setTimeout(()=>d(!1),1500)},[]);return{copied:a,copy:(0,r.hb)(()=>{!t||(i?c(i).then(u).catch(()=>{}):navigator.clipboard&&navigator.clipboard.writeText(n).then(u).catch(()=>{}))},[t,n,i,u]),download:(0,r.hb)(()=>{if(t){if(i)return void s(i,t.name).catch(()=>{});o(new Blob([n],{type:l}),t.name)}},[t,n,l,i])}}({target:e,content:M,imageUrl:A,downloadMimeType:p}),B=(0,r.hb)(()=>{L.current.clear(),C(e=>e+1)},[]),_=(0,r.hb)(e=>{let t=new Set(e.map(String));for(let e of Array.from(L.current))t.has(e)||L.current.delete(e);b(e=>{let n=Object.keys(e);if(n.every(e=>t.has(e)))return e;let r={};for(let i of n)t.has(i)&&(r[i]=e[i]);return r})},[]);return(0,r.vJ)(()=>{if(h)return()=>{let e=$.current;e&&(window.clearTimeout(e.timer),$.current=null,O.current(e.file,e.content))}},[h]),{content:M,onChange:R,isLoading:v,loadError:w,saveStatus:Y,copied:I,isDirty:z,language:e?(0,i.sQ)(e.name):"javascript",isImage:E,imageUrl:A,saveNow:K,copy:P,download:U,reset:B,retain:_}}},Soe(e,t,n){let r=(0,n("y").A)({name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]});n.d(t,{},{A:r})},yh(e,t,n){let r=(0,n("y").A)({name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]});n.d(t,{},{A:r})},na(e,t,n){let r=(0,n("y").A)({name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})},hj(e,t,n){let r=(0,n("y").A)({name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})}}]);
|
|
10
|
+
`;function d(){return(0,r.Y)("style",{dangerouslySetInnerHTML:{__html:c}})}function u(e,t){return e.substring(0,t).split("\n")}function h(e){let{value:t,onValueChange:n,highlight:l,padding:c=0,preClassName:h,textareaClassName:f,style:p,preRef:m,className:x,placeholder:b,readOnly:g,autoFocus:y,virtual:v}=e,k=(0,i.li)(null),w=(0,i.li)({stack:[],offset:-1}),[N,Y]=(0,i.J0)(!0);(0,i.vJ)(()=>{let e=k.current;e&&a(w.current,{value:e.value,selectionStart:e.selectionStart,selectionEnd:e.selectionEnd,timestamp:Date.now()})},[t]);let D=e=>{let t=k.current,r=w.current.stack[w.current.offset];r&&t&&(w.current.stack[w.current.offset]={...r,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}),function(e,t){if(a(e,t),e.stack.length<=100)return;let n=e.stack.length-100;e.stack=e.stack.slice(n),e.offset=Math.max(e.offset-n,0)}(w.current,{...e,timestamp:Date.now()}),n(e.value),t&&(t.value=e.value,t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd)},C={margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"},F={paddingTop:c,paddingRight:c,paddingBottom:c,paddingLeft:c},S={...F,paddingTop:c+(v?.top??0),paddingBottom:c+(v?.bottom??0)},M=l(t,v??null);return(0,r.FD)("div",{className:x,style:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden",...p},children:[(0,r.Y)("pre",{ref:m,className:h,"aria-hidden":"true",style:{...C,...S,position:"relative",pointerEvents:"none"},dangerouslySetInnerHTML:{__html:M+(v&&!v.breakAtEnd?"":"<br />")}}),(0,r.Y)("textarea",{ref:k,className:`code-editor-native-textarea${f?` ${f}`:""}`,style:{...C,...F,position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",WebkitTextFillColor:"transparent"},value:t,onChange:e=>{let{value:t,selectionStart:r,selectionEnd:i}=e.target,l=w.current,s=Date.now();if(function(e,t,n,r){if(!e||r-e.timestamp>=3e3)return!1;let i=o(e.value,e.selectionStart),l=o(t,n);return!!(i&&l?.startsWith(i))}(l.stack[l.offset],t,r,s)){l.stack=l.stack.slice(0,l.offset+1),l.stack[l.offset]={value:t,selectionStart:r,selectionEnd:i,timestamp:s},n(t);return}a(l,{value:t,selectionStart:r,selectionEnd:i,timestamp:s}),n(t)},onKeyDown:e=>{if("Escape"===e.key)return void e.currentTarget.blur();let{value:t,selectionStart:r,selectionEnd:i}=e.currentTarget,l=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),a=/Win/i.test(navigator.platform);if("Tab"===e.key&&N){if(e.preventDefault(),e.shiftKey){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=t.split("\n").map((e,t)=>t>=n&&t<=l&&e.startsWith(" ")?e.substring(2):e).join("\n");if(a!==t){let l=e[n];D({value:a,selectionStart:l?.startsWith(" ")?r-2:r,selectionEnd:i-(t.length-a.length)})}}else if(r!==i){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=e[n];D({value:t.split("\n").map((e,t)=>t>=n&&t<=l?" "+e:e).join("\n"),selectionStart:a&&/\S/.test(a)?r+2:r,selectionEnd:i+2*(l-n+1)})}else{let e=r+2;D({value:t.substring(0,r)+" "+t.substring(i),selectionStart:e,selectionEnd:e})}return}if("Backspace"===e.key&&r===i){if(t.substring(0,r).endsWith(" ")){e.preventDefault();let n=r-2;D({value:t.substring(0,r-2)+t.substring(i),selectionStart:n,selectionEnd:n})}return}if("Enter"===e.key&&r===i){let n=u(t,r).pop(),l=n?.match(/^\s+/);if(l?.[0]){e.preventDefault();let n="\n"+l[0],a=r+n.length;D({value:t.substring(0,r)+n+t.substring(i),selectionStart:a,selectionEnd:a})}return}if((l?e.metaKey&&"z"===e.key.toLowerCase():e.ctrlKey&&"z"===e.key.toLowerCase())&&!e.shiftKey&&!e.altKey){e.preventDefault();let t=s(w.current,"undo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}if((l?e.metaKey&&e.shiftKey&&"z"===e.key.toLowerCase():a?e.ctrlKey&&"y"===e.key.toLowerCase():e.ctrlKey&&e.shiftKey&&"z"===e.key.toLowerCase())&&!e.altKey){e.preventDefault();let t=s(w.current,"redo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}e.ctrlKey&&"m"===e.key.toLowerCase()&&(!l||e.shiftKey)&&(e.preventDefault(),Y(e=>!e))},placeholder:b,readOnly:g,autoFocus:y,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellcheck:!1,"data-gramm":!1}),(0,r.Y)(d,{})]})}let f=["direction","fontFamily","fontFeatureSettings","fontKerning","fontSize","fontStyle","fontVariantLigatures","fontWeight","letterSpacing","overflowWrap","tabSize","textRendering","textTransform","whiteSpace","wordBreak","wordSpacing"],p=null,m=[],x="",b=new Map,g=[];function y(e){if("u"<typeof document||!e.isConnected)return null;let t=Number.parseFloat(getComputedStyle(e).lineHeight);return Number.isFinite(t)&&t>0?t:null}function v(e,t,n){return e<t?t:e>n?n:e}function k(e){return{start:0,end:v(200,1,Math.max(e,1))}}var w=n("Po"),N=n("DU");function Y(e){var t;let{value:n,onValueChange:l,language:a,wordWrap:o,rootClassName:s,gutterClassName:c,gutterStyle:d,gutterLineClassName:u,editorWrapperClassName:Y,editorClassName:D,editorPadding:C=0,editorStyle:F}=e,S=o?"!whitespace-pre-wrap !break-words":"!whitespace-pre !break-normal",M=(0,i.li)(null),z=(0,i.li)(null),[T,E]=(0,i.J0)(null),[A,L]=(0,i.J0)(null),[$,j]=(0,i.J0)(-1);(0,w.w)();let J=(0,i.Kr)(()=>(function(e){let t=1;for(let n=e.indexOf("\n");-1!==n;n=e.indexOf("\n",n+1))t++;return t})(n),[n]),W=(0,i.hb)(()=>{let e=M.current;if(!e)return;let t=o?function(e,t){let n=y(e);if(null===n)return null;let r=getComputedStyle(e),i=e.clientWidth-Number.parseFloat(r.paddingLeft||"0")-Number.parseFloat(r.paddingRight||"0");if(i<=0)return null;let l=(p&&p.isConnected||((p=document.createElement("div")).setAttribute("aria-hidden","true"),p.style.cssText="position:fixed;top:0;left:-100000px;visibility:hidden;pointer-events:none;margin:0;border:0;padding:0;box-sizing:border-box;",document.body.appendChild(p),m=[]),p);for(let e of f)l.style[e]=r[e];l.style.lineHeight=`${n}px`,l.style.width=`${i}px`;let a=`${i}|${n}|${f.map(e=>r[e]).join("|")}`;a!==x&&(x=a,b.clear());let o=t.split("\n"),s=Array(o.length),c=0;for(let e=0;e<o.length;e++){let t=b.get(o[e]);void 0===t?g[c++]=e:s[e]=t}if(c>0){for(;m.length<c;){let e=document.createElement("div");l.appendChild(e),m.push(e)}for(let e=0;e<c;e++)m[e].textContent=o[g[e]];for(let e=0;e<c;e++){let t=g[e],r=m[e].getBoundingClientRect().height,i=r>n?Math.round(r/n)*n:n;s[t]=i,b.set(o[t],i)}if(b.size>1e5){let e=b.size-5e4;for(let t of b.keys()){if(e--<=0)break;b.delete(t)}}}return{rowHeight:n,heights:s}}(e,n):null;E(e=>e===t||e&&t&&e.rowHeight===t.rowHeight&&e.heights.length===t.heights.length&&e.heights.every((e,n)=>e===t.heights[n])?e:t);let r=t?.rowHeight??y(e);L(e=>e===r?e:r),j(J)},[n,J,o,C,F?.fontSize]);(0,i.Nf)(()=>{W()},[W]);let H=(0,i.li)(W);H.current=W,(0,i.vJ)(()=>{let e=M.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>H.current());return t.observe(e),()=>t.disconnect()},[]);let O=(0,i.Kr)(()=>null===A?null:T?function(e,t,n){if(0===n||e.length!==n)return null;let r=new Float64Array(n+1);for(let t=0;t<n;t++)r[t+1]=r[t]+e[t];let i=r[n];return{lineCount:n,rowHeight:t,totalHeight:i,offsetOf:e=>r[v(e,0,n)],lineAt:e=>{if(e<0)return 0;if(i<=0||e>=i)return n-1;let t=0,l=n-1;for(;t<l;){let n=t+l+1>>1;r[n]<=e?t=n:l=n-1}return t}}}(T.heights,T.rowHeight,J):{lineCount:J,rowHeight:A,totalHeight:A*J,offsetOf:e=>A*v(e,0,J),lineAt:e=>v(Math.floor(e/A),0,Math.max(J-1,0))},[A,T,J]),R=(t=n.length,J>300||t>2e4),K=function(e){var t,n;let r,l,{rootRef:a,lineCount:o,geometry:s,enabled:c}=e,[d,u]=(0,i.J0)(null),h=(0,i.hb)(()=>{let e,t,n,r,i=a.current;if(!c||!i)return;let l=s?(e=i.getBoundingClientRect().top,n=(t=function(e){for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e||"overlay"===e)&&t.scrollHeight>t.clientHeight)return t}return null}(i))?t.getBoundingClientRect().top:0,r=t?t.getBoundingClientRect().bottom:globalThis.innerHeight||s.rowHeight,function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:24,i=e.lineAt(t),l=e.lineAt(t+Math.max(n,0));return{start:Math.max(0,i-r),end:Math.min(e.lineCount,Math.max(l+1,i+1)+r)}}(s,n-e,r-n)):k(o);u(e=>e===l||null!==e&&null!==l&&e.start===l.start&&e.end===l.end?e:l)},[c,s,o,a]);(0,i.Nf)(()=>{h()},[h]);let f=(0,i.li)(h);if(f.current=h,(0,i.vJ)(()=>{if(!c)return;let e=0,t=()=>{e||(e=requestAnimationFrame(()=>{e=0,f.current()}))};window.addEventListener("scroll",t,{passive:!0,capture:!0}),window.addEventListener("resize",t);let n="u"<typeof ResizeObserver?null:new ResizeObserver(t),r=a.current;return r&&n?.observe(r),()=>{e&&cancelAnimationFrame(e),window.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t),n?.disconnect()}},[c,a]),!c)return null;if(!s){let e=k(o);return{...e,top:0,bottom:0,breakAtEnd:e.end>=o}}return t=d??k(s.lineCount),n=s.lineCount,{...l={start:r=v(t.start,0,Math.max(n-1,0)),end:v(t.end,r+1,Math.max(n,1))},...{top:s.offsetOf(l.start),bottom:Math.max(0,s.totalHeight-s.offsetOf(l.end)),breakAtEnd:l.end>=s.lineCount}}}({rootRef:z,lineCount:J,geometry:O,enabled:R&&($!==J||null!==O)}),I=(0,i.hb)((e,t)=>t?function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{contextLines:i=40,maxLineLength:l=12e3}=r,a=e.split("\n"),o=Math.min(Math.max(n.start,0),a.length),s=Math.min(Math.max(n.end,o),a.length);if(o===s)return"";let c=Math.max(0,o-i),d=(0,N.O9)(a.slice(c,s).join("\n"),t,{maxLineLength:l}),u=o-c;return`<span class="shiki">${d.slice(u,u+(s-o)).join("\n")}</span>`}(e,a,t):(0,N.wY)(e,a),[a]),P=K?K.start:0,U=K?Math.min(K.end,J):J,B=[];for(let e=P;e<U;e++)B.push(e);let _=T&&T.heights.length===J?T.heights:null;return(0,r.FD)("div",{className:s,ref:z,children:[(0,r.FD)("div",{className:c,style:d,children:[K&&K.top>0?(0,r.Y)("div",{style:{height:K.top,flexShrink:0},"aria-hidden":"true"}):null,B.map(e=>(0,r.Y)("div",{className:u,style:_?{height:_[e],flexShrink:0}:void 0,children:e+1},e+1))]}),(0,r.Y)("div",{className:Y,children:(0,r.Y)(h,{value:n,onValueChange:l,highlight:I,padding:C,preRef:M,textareaClassName:`focus:outline-none ${S}`,preClassName:S,style:F,className:D,virtual:K})})]})}},hR(e,t,n){var r=n("j"),i=n("H"),l=n("E6"),a=n("t");function o(e){let{src:t,name:n,className:o=""}=e,s=(0,i.li)(null),c=(0,i.li)(null),d=(0,i.li)(null),[u,h]=(0,i.J0)(null),[f,p]=(0,i.J0)(1),[m,x]=(0,i.J0)({x:0,y:0}),[b,g]=(0,i.J0)(!1),[y,v]=(0,i.J0)(null),k=(0,i.hb)(()=>{let e=c.current;return!!e&&!!e.complete&&0!==e.naturalWidth&&(h({width:e.naturalWidth,height:e.naturalHeight}),!0)},[]);(0,i.vJ)(()=>{k()},[k]);let w=(0,i.hb)(()=>{let e=c.current,t=s.current?.getBoundingClientRect(),n=e?.naturalWidth??0,r=e?.naturalHeight??0;t&&n&&r&&(p(Math.min(1,Math.max(.1,(t.width-48)/n,(t.height-48)/r))),x({x:0,y:0}))},[]);(0,i.vJ)(()=>{u&&w()},[u,w]);let N=(0,i.hb)(e=>{p(t=>Math.min(16,Math.max(.1,t*e)))},[]),Y=(0,i.hb)(e=>{e.preventDefault(),N(Math.exp(-(.0015*e.deltaY)))},[N]),D=(0,i.hb)(e=>{0===e.button&&u&&(d.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY},e.currentTarget.setPointerCapture(e.pointerId),g(!0))},[u]),C=(0,i.hb)(e=>{let t=d.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.x,r=e.clientY-t.y;t.x=e.clientX,t.y=e.clientY,x(e=>({x:e.x+n,y:e.y+r}))},[]),F=(0,i.hb)(e=>{d.current?.pointerId===e.pointerId&&(d.current=null,g(!1))},[]),S=(0,i.hb)(()=>{.01>Math.abs(f-1)?w():(p(1),x({x:0,y:0}))},[f,w]);(0,i.vJ)(()=>{let e=e=>{if("+"!==e.key&&"="!==e.key&&"-"!==e.key&&"_"!==e.key&&"0"!==e.key)return;let t=e.target;t&&s.current?.contains(t)&&(e.preventDefault(),"0"===e.key?w():"+"===e.key||"="===e.key?N(1.4):N(1/1.4))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[N,w]);let M=Math.round(100*f),z=u?`${u.width} \xd7 ${u.height} px`:"";return(0,r.FD)("div",{className:`relative flex h-full w-full flex-col bg-paper ${o}`,children:[(0,r.Y)("div",{ref:s,tabIndex:-1,onWheel:Y,onPointerDown:D,onPointerMove:C,onPointerUp:F,onPointerCancel:F,onDblClick:S,className:`image-stage relative flex-1 overflow-hidden outline-none ${b?"cursor-grabbing":"cursor-grab"}`,children:y?(0,r.FD)("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-6 text-center",children:[(0,r.Y)(l.A,{size:20,className:"text-error"}),(0,r.FD)("span",{className:"font-sans text-xs text-error",children:["Could not read ",n]}),(0,r.Y)("span",{className:"break-all font-mono text-[11px] text-ink/50",children:y})]}):(0,r.FD)(r.FK,{children:[!u&&(0,r.FD)("div",{className:"absolute inset-0 flex items-center justify-center gap-2 text-xs text-ink/40",children:[(0,r.Y)(a.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading image…"})]}),(0,r.Y)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,r.Y)("img",{ref:c,src:t,alt:n,draggable:!1,onLoad:k,onError:()=>v("The file could not be decoded as an image."),className:"image-canvas max-h-none max-w-none select-none",style:{transform:`translate3d(${m.x}px, ${m.y}px, 0) scale(${f})`,visibility:u?"visible":"hidden"}})})]})}),(0,r.FD)("div",{className:"flex flex-shrink-0 items-center justify-between border-t border-ink/10 bg-canvas px-3 py-1.5 font-mono text-[10px] text-ink/50",children:[(0,r.Y)("span",{children:z}),(0,r.FD)("div",{className:"flex items-center gap-3",children:[(0,r.Y)("button",{type:"button",onClick:()=>N(1/1.4),className:"hover:text-ink",title:"Zoom out (-)",children:"−"}),(0,r.FD)("span",{className:"w-10 text-center tabular-nums",children:[M,"%"]}),(0,r.Y)("button",{type:"button",onClick:()=>N(1.4),className:"hover:text-ink",title:"Zoom in (+)",children:"+"}),(0,r.Y)("button",{type:"button",onClick:w,className:"hover:text-ink",title:"Fit to view (0)",children:"Fit"})]})]})]})}function s(e){return(0,r.Y)(o,{...e},e.src)}n.d(t,{a:()=>s})},Xg(e,t,n){n.d(t,{M:()=>C});var r=n("j"),i=n("H"),l=n("X"),a=n("FL"),o=n("DU"),s=n("lP"),c=n("y");let d=(0,c.A)({name:"text-align-justify",size:24,node:[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],aliases:["align-justify"]}),u=(0,c.A)({name:"space",size:24,node:[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]});var h=n("n"),f=n("z"),p=n("b0"),m=n("I"),x=n("DV"),b=n("r"),g=n("AB"),y=n("pX"),v=n("LQ");function k(e){let{filePath:t,status:n,isStaged:i,viewMode:l,ignoreWhitespace:a,additions:o,deletions:c,isLoading:k,isCopied:w,onToggleViewMode:N,onToggleWhitespace:Y,onStageUnstage:D,onDiscard:C,onOpenInEditor:F,onRefresh:S,onCopyDiff:M}=e,z=t.split("/").pop()||t,T=(0,v.R)(n,i);return(0,r.FD)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-paper border-b border-ink/10 text-xs font-sans select-none flex-shrink-0 overflow-x-auto no-scrollbar",children:[(0,r.FD)("div",{className:"hidden md:flex items-center space-x-2 min-w-0 pr-2",children:[(0,r.Y)(y.o,{name:z,size:14,className:"flex-shrink-0"}),(0,r.Y)("span",{className:"font-mono text-ink font-medium truncate",title:t,children:z}),(0,r.FD)("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border ${T.badgeBgClass} flex-shrink-0`,children:[T.charStatus," ",T.label]}),(o>0||c>0)&&(0,r.FD)("div",{className:"flex items-center space-x-1.5 text-[11px] font-mono flex-shrink-0 ml-1",children:[o>0&&(0,r.FD)("span",{className:"text-success font-semibold",children:["+",o]}),c>0&&(0,r.FD)("span",{className:"text-error font-semibold",children:["-",c]})]})]}),(0,r.FD)("div",{className:"flex items-center space-x-1 text-ink/70 flex-shrink-0 ml-auto",children:[(0,r.FD)("div",{className:"flex items-center bg-canvas rounded border border-ink/15 p-0.5 mr-1",children:[(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"split"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Split (side-by-side) Diff",children:[(0,r.Y)(s.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Split"})]}),(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"unified"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Unified Diff",children:[(0,r.Y)(d,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Unified"})]})]}),(0,r.Y)("button",{type:"button",onClick:Y,className:`p-1.5 rounded transition-colors ${a?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:a?"Whitespace ignored":"Ignore whitespace",children:(0,r.Y)(u,{size:13})}),(0,r.Y)("button",{type:"button",onClick:S,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Refresh Diff",disabled:k,children:(0,r.Y)(h.A,{size:13,className:k?"animate-spin":""})}),(0,r.Y)("button",{type:"button",onClick:M,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Copy Diff Text",children:w?(0,r.Y)(f.A,{size:13,className:"text-success"}):(0,r.Y)(p.A,{size:13})}),!i&&(0,r.Y)("button",{type:"button",onClick:C,className:"p-1.5 text-ink/50 hover:text-error hover:bg-error/10 rounded transition-colors",title:"Discard changes in this file",children:(0,r.Y)(m.A,{size:13})}),(0,r.Y)("button",{type:"button",onClick:D,className:"px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink",title:i?"Unstage file":"Stage file",children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)(x.A,{size:12}),(0,r.Y)("span",{children:"Unstage"})]}):(0,r.FD)(r.FK,{children:[(0,r.Y)(b.A,{size:12}),(0,r.Y)("span",{children:"Stage"})]})}),F&&(0,r.FD)("button",{type:"button",onClick:F,className:"px-2 py-1 text-[11px] font-medium rounded bg-ink text-canvas hover:bg-ink/90 flex items-center space-x-1 transition-colors shadow-xs ml-1",title:"Open in Code Editor",children:[(0,r.Y)(g.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Edit File"})]})]})]})}var w=n("Po");function N(e){let{lines:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=-1,i=i=>{if(r<0)return;let l=(0,o.O9)(t.slice(r,i).map(e=>e.text).join("\n"),n);for(let t=r;t<i;t++)e[t]=l[t-r]??"";r=-1};return t.forEach((e,t)=>{"meta"===e.type?i(t):r<0&&(r=t)}),i(t.length),e},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.Y)("div",{className:"pb-4",children:(0,r.Y)("table",{className:"w-max min-w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if("meta"===e.type)return(0,r.FD)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:[(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"py-1 px-3 text-[11px] font-semibold text-meta font-mono tracking-tight",children:e.text})]},t);let n="add"===e.type,i="del"===e.type;return(0,r.FD)("tr",{className:`transition-colors group ${n?"bg-success/10 hover:bg-success/15":i?"bg-error/10 hover:bg-error/15":"hover:bg-ink/[0.03]"}`,children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${i?"bg-error/15 text-error font-semibold":n?"bg-success/15 text-success/70":"bg-canvas/50 text-ink/40"}`,children:e.oldLineNumber||""}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${n?"bg-success/15 text-success font-semibold":i?"bg-error/15 text-error/70":"bg-canvas/50 text-ink/40"}`,children:e.newLineNumber||""}),(0,r.FD)("td",{className:"py-0.5 px-3 whitespace-pre text-ink pr-6",children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${n?"text-success":i?"text-error":"opacity-0"}`,children:n?"+":i?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:e.text&&a[t]||" "}})]})]},t)})})})})})}function Y(e){let{rows:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=Array(t.length).fill(""),i=-1,l=l=>{if(i<0)return;let a=t.slice(i,l),s=(0,o.O9)(a.map(e=>e.left?.text??"").join("\n"),n),c=(0,o.O9)(a.map(e=>e.right?.text??"").join("\n"),n);for(let t=i;t<l;t++)e[t]=s[t-i]??"",r[t]=c[t-i]??"";i=-1};return t.forEach((e,t)=>{e.isMeta?l(t):i<0&&(i=t)}),l(t.length),{left:e,right:r}},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.FD)("div",{className:"w-max min-w-full min-w-[700px] pb-4",children:[(0,r.FD)("div",{className:"grid grid-cols-2 sticky top-0 z-10 bg-canvas border-b border-ink/10 text-[11px] text-ink/70 font-sans select-none shadow-xs",children:[(0,r.Y)("div",{className:"px-3 py-1 font-medium border-r border-ink/10 flex items-center justify-between",children:(0,r.Y)("span",{children:"Original (HEAD / Base)"})}),(0,r.Y)("div",{className:"px-3 py-1 font-medium flex items-center justify-between",children:(0,r.Y)("span",{children:"Modified (Working Tree)"})})]}),(0,r.Y)("table",{className:"w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if(e.isMeta)return(0,r.Y)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:(0,r.Y)("td",{colSpan:4,className:"py-1 px-3 text-[11px] font-semibold text-meta text-center font-mono",children:e.metaText})},t);let n=e.left,i=e.right,l=n?.type==="del",o=i?.type==="add";return(0,r.FD)("tr",{className:"border-b border-ink/[0.04]",children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${l?"bg-error/15 text-error font-semibold":n?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:n?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre border-r border-ink/10 text-ink ${l?"bg-error/10":n?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:n?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${l?"text-error":"opacity-0"}`,children:l?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:n.text&&a.left[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${o?"bg-success/15 text-success font-semibold":i?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:i?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre text-ink ${o?"bg-success/10":i?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${o?"text-success":"opacity-0"}`,children:o?"+":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:i.text&&a.right[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})})]},t)})})})]})})}var D=n("p");function C(e){let{filePath:t,status:n="M",isStaged:s=!1,root:c,repo:d=".",onOpenInEditor:u,onFileSaved:f,className:p=""}=e,[m,x]=(0,a.LO)("diff.viewMode","unified"),[b,g]=(0,a.LO)("diff.ignoreWhitespace",!1),[y,v]=(0,i.J0)(""),[w,C]=(0,i.J0)(n),[F,S]=(0,i.J0)(s),[M,z]=(0,i.J0)(!0),[T,E]=(0,i.J0)(null),[A,L]=(0,i.J0)(!1),[$,j]=(0,i.J0)(!1),J=(0,l.L)(),W=(0,i.hb)(async()=>{if(t){z(!0),E(null);try{let e=new URLSearchParams({fileDiff:"1",file:t,staged:F?"1":"0",repo:d||"."});(n||w)&&e.set("status",n||w),c&&e.set("root",c);let r=await fetch(`/api/fs/git?${e.toString()}`),i=await r.json();i.success?(v(i.diff||""),i.status&&C(i.status)):E(i.error||"Failed to load file diff")}catch(e){E(e.message||"Error fetching diff")}finally{z(!1)}}},[t,F,d,c]);(0,i.vJ)(()=>{C(n),S(s)},[n,s,t]),(0,i.vJ)(()=>{W()},[W]);let H=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=[],i=0,l=0;if(!e||!e.trim())return{lines:n,splitRows:r,additions:i,deletions:l};let a=e.split(/\r?\n/),o=a.some(e=>e.startsWith("@@"))?a:[`@@ -1,${a.length} +1,${a.length} @@`,...a],s=1,c=1,d=[],u=[],h=()=>{let e=Math.max(d.length,u.length);for(let t=0;t<e;t++)r.push({left:d[t]?{type:"del",text:d[t].text,lineNumber:d[t].lineNumber}:void 0,right:u[t]?{type:"add",text:u[t].text,lineNumber:u[t].lineNumber}:void 0});d=[],u=[]};for(let e of o)if(!(e.startsWith("diff --git")||e.startsWith("index ")||e.startsWith("---")||e.startsWith("+++")||e.startsWith("new file mode")||e.startsWith("deleted file mode")||e.startsWith("similarity index")||e.startsWith("old mode")||e.startsWith("new mode")||e.startsWith("\\ No newline"))){if(e.startsWith("@@")){h();let t=e.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);t&&(s=parseInt(t[1],10),c=parseInt(t[2],10)),n.push({type:"meta",text:e}),r.push({isMeta:!0,metaText:e});continue}if(e.startsWith("+")){let r=e.slice(1),l=t?r.trim():r;i++,n.push({type:"add",text:l,newLineNumber:c}),u.push({text:l,lineNumber:c}),c++}else if(e.startsWith("-")){let r=e.slice(1),i=t?r.trim():r;l++,n.push({type:"del",text:i,oldLineNumber:s}),d.push({text:i,lineNumber:s}),s++}else{h();let i=e.startsWith(" ")?e.slice(1):e,l=t?i.trim():i;n.push({type:"context",text:l,oldLineNumber:s,newLineNumber:c}),r.push({left:{type:"context",text:l,lineNumber:s},right:{type:"context",text:l,lineNumber:c}}),s++,c++}}return h(),{lines:n,splitRows:r,additions:i,deletions:l}}(y,b),O=(0,o.sQ)(t);return(0,r.FD)("div",{className:`flex flex-col min-h-0 bg-paper select-text relative font-sans ${p}`,children:[(0,r.Y)(k,{filePath:t,status:w,isStaged:F,viewMode:m,ignoreWhitespace:b,additions:H.additions,deletions:H.deletions,isLoading:M,isCopied:A,onToggleViewMode:()=>{x("unified"===m?"split":"unified")},onToggleWhitespace:()=>{g(!b)},onStageUnstage:()=>{let e=F?"unstage":"stage",n=new FormData;n.set("actionType",e),n.set("file",t),n.set("repo",d||"."),c&&n.set("root",c),J.submit(n,{method:"POST",action:"/api/fs/git"}),S(!F),setTimeout(()=>{W(),f?.()},300)},onDiscard:()=>{j(!0)},onOpenInEditor:u,onRefresh:W,onCopyDiff:()=>{y&&(navigator.clipboard.writeText(y),L(!0),setTimeout(()=>L(!1),2e3))}}),(0,r.Y)("div",{className:"flex-1 overflow-hidden relative flex flex-col bg-paper",children:M?(0,r.FD)("div",{className:"flex-1 flex items-center justify-center space-x-2 text-ink/50 text-xs font-mono",children:[(0,r.Y)(h.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading file diff..."})]}):T?(0,r.FD)("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center space-y-2",children:[(0,r.Y)(D.A,{size:20,className:"text-error"}),(0,r.Y)("p",{className:"text-xs text-error font-medium",children:T}),(0,r.Y)("button",{onClick:W,className:"px-3 py-1 text-xs bg-ink/10 hover:bg-ink/15 text-ink rounded font-sans transition-colors",children:"Retry"})]}):"split"===m?(0,r.Y)(Y,{rows:H.splitRows,language:O}):(0,r.Y)(N,{lines:H.lines,language:O})}),$&&(0,r.Y)("div",{className:"fixed inset-0 bg-ink/20 z-50 flex items-center justify-center p-4 backdrop-blur-xs",children:(0,r.FD)("div",{className:"bg-paper rounded-lg shadow-xl p-4 w-full max-w-sm border border-ink/15",children:[(0,r.Y)("h3",{className:"font-semibold text-ink mb-1.5 text-sm",children:"Discard Changes?"}),(0,r.FD)("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to discard all unstaged changes in ",(0,r.Y)("span",{className:"font-mono font-medium text-ink",children:t}),"? This cannot be undone."]}),(0,r.FD)("div",{className:"flex justify-end space-x-2",children:[(0,r.Y)("button",{type:"button",onClick:()=>j(!1),className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",children:"Cancel"}),(0,r.Y)("button",{type:"button",onClick:()=>{j(!1);let e=new FormData;e.set("actionType","discard"),e.set("file",t),e.set("repo",d||"."),c&&e.set("root",c),J.submit(e,{method:"POST",action:"/api/fs/git"}),setTimeout(()=>{W(),f?.()},300)},className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 font-medium transition-colors",children:"Discard Changes"})]})]})})]})}},HQ(e,t,n){n.d(t,{n:()=>p});var r=n("H"),i=n("DU"),l=n("JK"),a=n("tZ");function o(e){return e.includes("\r")?e.replace(/\r\n?/g,"\n"):e}async function s(e,t,n){if(!e.path)return!1;let r=new FormData;r.append("actionType","save"),r.append("path",e.path),r.append("content",t),r.append("eol",n),e.root&&r.append("root",e.root),e.repo&&"."!==e.repo&&r.append("repo",e.repo);try{let e=await fetch("/api/fs/action",{method:"POST",body:r}),t=await e.json().catch(()=>null);return!!(e.ok&&t?.success)}catch{return!1}}function c(e,t){let n=Object.keys(e);if(n.every(e=>t.has(e)))return e;let r={};for(let i of n)t.has(i)&&(r[i]=e[i]);return r}function d(e,t){let n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}async function u(e,t){let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);d(await n.blob(),t)}async function h(e){let t=await fetch(e);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.blob();if("u"<typeof ClipboardItem||!navigator.clipboard?.write)throw Error("Image clipboard unavailable");await navigator.clipboard.write([new ClipboardItem({[n.type]:n})])}function f(e){return String(e.id??e.path??e.name)}function p(e){var t;let n,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{fallback:m,reportLoadError:x=!1,flushOnUnmount:b=!1,reportSaveError:g=!1,downloadMimeType:y="text/plain",onFileSaved:v}=p,[k,w]=(0,r.J0)({}),[N,Y]=(0,r.J0)({}),[D,C]=(0,r.J0)({}),[F,S]=(0,r.J0)(!1),[M,z]=(0,r.J0)(null),[T,E]=(0,r.J0)("idle"),[A,L]=(0,r.J0)(0),$=e?f(e):"",j=e?k[$]??(void 0!==e.content?o(e.content):""):"",J=j!==(N[$]??j),W=e?.path&&void 0===e.content&&(0,l.CC)(e.path)?e.path:null,H=null!==W,O=W?`${(0,a.l)({...e,path:W})}&v=${A}`:null,R=(0,r.li)(new Set),K=(0,r.li)(null),I=(0,r.li)(k);I.current=k;let P=(0,r.li)(N);P.current=N;let U=(0,r.li)(D);U.current=D;let B=(0,r.hb)((e,t)=>{let n,r=(n=t.indexOf("\n"))>0&&"\r"===t[n-1]?"crlf":"lf",i=o(t);w(t=>({...t,[e]:i})),Y(t=>({...t,[e]:i})),C(t=>({...t,[e]:r}))},[]),_=(0,r.hb)(async(e,t)=>{if(!e.path)return;E("saving");let n=f(e);await s(e,t,U.current[n]??"lf")?(E("saved"),Y(e=>({...e,[n]:t})),v?.()):E(g?"error":"idle")},[v,g]),X=(0,r.li)(_);X.current=_,(0,r.vJ)(()=>{if(!e)return;let t=f(e);if(R.current.has(t))return;if(R.current.add(t),H){z(null),S(!1);return}if(void 0!==e.content){B(t,e.content),z(null);return}if(!e.path)return x?void z("No file path supplied for this attachment."):void B(t,m?m(e.name):"");let n=void 0===I.current[t],r=!1;n&&S(!0),z(null);let i=new URLSearchParams({path:e.path});return e.root&&i.set("root",e.root),e.repo&&"."!==e.repo&&i.set("repo",e.repo),fetch(`/api/fs/read?${i.toString()}`).then(async e=>{let t=await e.json().catch(()=>null);if(x){if(!e.ok||!t||"string"!=typeof t.content)throw Error(t?.error||`HTTP ${e.status}`);return t.content}return"string"==typeof t?.content?t.content:null}).then(n=>{if(r)return;let i=I.current[t];if(void 0!==i&&i!==P.current[t])return;let l=K.current;l&&f(l.file)===t||B(t,n??(m?m(e.name):""))}).catch(i=>{r||n&&(x?(B(t,""),z(i instanceof Error?i.message:"Failed to read file")):B(t,m?m(e.name):""))}).finally(()=>{r||S(!1)}),()=>{r=!0}},[$,e,m,x,B,A,H]),(0,r.vJ)(()=>{if("saved"!==T)return;let e=window.setTimeout(()=>E("idle"),1500);return()=>window.clearTimeout(e)},[T]);let V=(0,r.hb)(t=>{if(!e||H)return;let n=f(e);if(w(e=>({...e,[n]:t})),!e.path)return;K.current&&window.clearTimeout(K.current.timer);let r=window.setTimeout(()=>{K.current=null,X.current(e,t)},800);K.current={timer:r,file:e,content:t}},[e,H]),Q=(0,r.hb)(()=>{if(!e||H)return;let t=k[f(e)];void 0!==t&&(K.current&&(window.clearTimeout(K.current.timer),K.current=null),X.current(e,t))},[e,k,H]),{copied:Z,copy:q,download:G}=function(e){let{target:t,content:n,downloadContent:i,imageUrl:l,downloadMimeType:a}=e,[o,s]=(0,r.J0)(!1),c=(0,r.hb)(()=>{s(!0),window.setTimeout(()=>s(!1),1500)},[]);return{copied:o,copy:(0,r.hb)(()=>{!t||(l?h(l).then(c).catch(()=>{}):navigator.clipboard&&navigator.clipboard.writeText(n).then(c).catch(()=>{}))},[t,n,l,c]),download:(0,r.hb)(()=>{if(t){if(l)return void u(l,t.name).catch(()=>{});d(new Blob([i],{type:a}),t.name)}},[t,i,a,l])}}({target:e,content:j,downloadContent:e?(t=D[$]??"lf",n=o(j),"crlf"===t?n.replace(/\n/g,"\r\n"):n):j,imageUrl:O,downloadMimeType:y}),ee=(0,r.hb)(()=>{R.current.clear(),L(e=>e+1)},[]),et=(0,r.hb)(e=>{let t=new Set(e.map(String));for(let e of Array.from(R.current))t.has(e)||R.current.delete(e);w(e=>c(e,t)),C(e=>c(e,t))},[]);return(0,r.vJ)(()=>{if(b)return()=>{let e=K.current;e&&(window.clearTimeout(e.timer),K.current=null,X.current(e.file,e.content))}},[b]),{content:j,onChange:V,isLoading:F,loadError:M,saveStatus:T,copied:Z,isDirty:J,language:e?(0,i.sQ)(e.name):"javascript",isImage:H,imageUrl:O,saveNow:Q,copy:q,download:G,reset:ee,retain:et}}},Soe(e,t,n){let r=(0,n("y").A)({name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]});n.d(t,{},{A:r})},yh(e,t,n){let r=(0,n("y").A)({name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]});n.d(t,{},{A:r})},na(e,t,n){let r=(0,n("y").A)({name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})},hj(e,t,n){let r=(0,n("y").A)({name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})}}]);
|